Hi,

I did not find any support until now for the node add forms, so I created a small module that does that. I didn't create a separate project for it because maybe it makes sense to integrate this directly in the Modal forms module, otherwise I can create a full project. The module provides settings per content type, so you can choose for which content types you want to have modal forms (and only for add forms, not for edit, at the moment).

Vasi.

CommentFileSizeAuthor
modal_forms_nodes.zip3.54 KBvasi1186
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cjtriplett’s picture

This is brilliant! This should definitely be committed to the Modal Forms module.

El Bandito’s picture

+1 for this to be integrated. Node edit forms would be a bonus.

mareks’s picture

Fresh D7.22, default installation.

Almost works. But the image upload gives an error:

Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'node_form' was given in drupal_retrieve_form() (line 798 of /www/d7/includes/form.inc).

Notice: Undefined index: #node in comment_form_node_form_alter() (line 1206 of /www/d7/modules/comment/comment.module).

Notice: Trying to get property of non-object in comment_form_node_form_alter() (line 1223 of /www/d7/modules/comment/comment.module).

Notice: Undefined index: #node in menu_form_node_form_alter() (line 629 of /www/d7/modules/menu/menu.module).

Notice: Trying to get property of non-object in menu_form_node_form_alter() (line 629 of /www/d7/modules/menu/menu.module).

Notice: Undefined index: #node in menu_form_node_form_alter() (line 630 of /www/d7/modules/menu/menu.module).

Notice: Trying to get property of non-object in menu_form_node_form_alter() (line 630 of /www/d7/modules/menu/menu.module).

Notice: Undefined index: field_image in file_ajax_upload() (line 271 of /www/d7/modules/file/file.module).

Notice: Undefined index: #suffix in file_ajax_upload() (line 280 of /www/d7/modules/file/file.module).
bjalford’s picture

1) What needs to be done to get the edit form working?

2) How could this work with the entity ref prepopulate module?

melang’s picture

Subscribing!!! Please fix the errors and add the node edit form. It will save tons of time for people like me, I've spent around a week trying to figure out ctools' modal forms. (One node form is done now, a couple more + css to go, ugh).

cmcs’s picture

Also subscribing. Getting the same error as #3.

cmcs’s picture

As I posted my previous comment I came across another article. It dealt with a similar issue, and I tried a modified version of the fix.

All you have to do is open modal_forms_nodes.pages.inc and edit the modal_forms_nodes_node_add function.

Add in :

form_load_include($form_state, 'inc', 'node', 'node.pages');

Just before:

$output = ctools_modal_form_wrapper($node_type . '_node_form', $form_state);

This has done the trick for me, and I hope it helps someone else.

allvip’s picture

when I click preview directs to home page and my content is not published.

allvip’s picture

Issue summary: View changes

small typo.

Coupon Code Swap’s picture

I am using the attached module. One issue I have run into is when I have the CDN module https://drupal.org/project/cdn serving javascript files, certain AJAX functions do not work, i.e.

Date Popup Calendar: https://drupal.org/project/date
Dependant Fields: https://drupal.org/project/dependent_fields

On first page visit, upon clicking the create node link, the AJAX from those two modules do not fire. If I close the form and reopen the link to create a node without reloading the page, then the AJAX is working. It seems something isn't properly being pre-loaded when the create node link is first visited.

phandolin’s picture

Issue summary: View changes

Thank you so much! This is what I was looking for all along.

phandolin’s picture

This works very well, the only thing I've noticed is that when I save the node, it just hangs with the blue spinning wheel. If I close the box, the node is saved, but it doesn't close automatically. Any ideas on how to get the box to close automatically after content is submitted?