Duplicating the node/add form

3 replies [Last post]
ahickman
Offline
Last seen: 10 years 48 weeks ago
Joined: 2011-03-30

I am creating a module that is going to have several content types that I would like to make a user interface that would have a default tab with a list of the nodes created and an "Add New" tab that is a duplicate of the node/add form.

Is it possible to duplicate the node/add form on the tab rather than having to link to the node/add page? My end goal is just to make the user interface a little more intuitive. I understand that I can create a form that resembles the page, but can I pull Drupal's version of the form in case the end user has added additional fields or anything.

Chris Shattuck
Offline
Last seen: 10 weeks 3 days ago
Joined: 2009-08-16
Hi Alex! You know, I haven't

Hi Alex!

You know, I haven't had to do this yet, but here's a thread on StackOverflow about it: http://stackoverflow.com/questions/5344754/drupal-7-how-to-display-node-... . That also points to a module called Form Block, which may help, though the Drupal 7 version looks like it's currently in development.

If this ends up being a common question, I will gladly put together a video on it.

Let me know how it goes after you've had a chance to take a look.

Cheers!
Chris

ahickman
Offline
Last seen: 10 years 48 weeks ago
Joined: 2011-03-30
node_add($node_type)

I tried that solution and couldn’t get it to work, but it opened my eyes on how to read some of the documentation on drupal.org and where to look. I got it to work with a different function. Let me know if you think there is any reason not to do it this way. I am new to programming, so I am always concerned with opening up the wrong functions.

module_load_include('inc', 'node', 'node.pages');
$node_type = 'YOURNODETYPE';
$output = node_add($node_type);
return $output;

Chris Shattuck
Offline
Last seen: 10 weeks 3 days ago
Joined: 2009-08-16
Hi Alex, Nothing about that

Hi Alex,

Nothing about that looks wrong off the bat, but I'd need to dig in to really know if this is the best way. If you get your data saved and the form looks right, then I'd say you probably have a winner. :)

Cheers!
Chris

Add to playlist

Add to , or

Add to new playlist:

Add to playlist
This is a member-only feature
But, it's easy to become a member

Add to cart:


Loading...
Contact us

Below are the supported keyboard shortcuts for our video player.

space
Start / stop video
shift
Go to next video
shift
Go to previous video
Increase or decrease player speed by 20%
Skip ahead or go back by 15 seconds
1...9
Jump to a percentage (2 is 20%, for example)
f
Toggle full screen
Videos Pricing More Search
BuildAModule Logo Icon BuildAModule Logo Icon
Become a member!
$29
1 month
$156
6 months
10% off
$276
12 months
20% off
All memberships come with the following:
24 / 7 access to the entire 1800+ video library
An innovative video player with a rolling transcript
Extensive Drupal and cross-platform training
A thorough and thoughtful training style
Progress tracking
Take notes on specific video sections
Intuitive multi-user management
How many users?
user
Go solo with a single user, or give multiple team members access through one account and get discounts by bundling multiple users into a single membership.