Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I am trying to get a node form to appear in the modal. No luck so far. Here's what I have-- the content type is "note". Any tips?
function mymodule_menu() {
$items['node/add/note'] = array(
'modal' => TRUE, // This line is where the magic happens.
'page callback' => 'drupal_get_form',
'page arguments' => array('note_node_form'),
'access arguments' => array('administer user'),
'modal' => TRUE,
);
}
Comment | File | Size | Author |
---|---|---|---|
#2 | Screen shot 2012-01-31 at 8.50.26 AM.jpg | 30.88 KB | capellic |
Comments
Comment #1
capellicAh, of course, hook_menu_alter:
Comment #2
capellicI spoke too soon. Getting the following error:
This is the same error that is occurring in this case: #1420526: getting An AJAX HTTP error occurred. HTTP Result Code: 200
Except I think what I'm trying to do is a lot simpler. I'm not passing in a destination on the link. It looks like this: node/add/note/nojs
Comment #3
capellicChanging status.
Comment #4
jlyon CreditAttribution: jlyon commentedI updated the patched version of this module (see #1420534: Consider a new hook - hook_ctools_automodal_paths() rather than using hook_menu() #4) so that it works with node/add pages. I needed to make a couple changes because the callback for those pages is
node_add()
notdrupal_get_form()
so ctools_automodal was serving it as a static page, not a form.These changes are my fork of the module: https://github.com/jlyon/ctools_automodal.
Comment #5
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedi tried the new git hub version
Issues happen when there is a form within a form
so I used ctools_automodal_admin to have node/add/mycontent type popup
that works fine
I have a media 2 field.
I click on media and there is a popup that is blank.
and there is no way to get out of it
I then have entityconnect which has its own popup
a big ajax error came up
I was at least able to hit return to close the dialogue box
Edit:
I wonder if my issues stem from the basic architecture of modal in ctools
see: https://drupal.org/node/1470762
Comment #6
jlyon CreditAttribution: jlyon commentedHmm, it sounds like like multiple jquery ui dialogs are conflicting with each other. I'm not sure I can offer a helpful solution.
I thought I had this working with a media 2 select field, but I may be wrong.
Comment #7
jlyon CreditAttribution: jlyon commentedHmm, it sounds like like multiple jquery ui dialogs are conflicting with each other. I'm not sure I can offer a helpful solution.
I thought I had this working with a media 2 select field, but I may be wrong.
Comment #8
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedthe media 7.2.x.dev issue might be it's own bug so let's remove that from the discussion.
but there does seem to be an issue with a popup inside a modal. hmmm.....
Comment #9
capellic@jlyon, I am using your forked version and am still getting the 200 message in the alert. The contents of the 200 alert is the newly created node, so it feels like the modal isn't "catching" what Drupal returns?
In hook_modal_paths:
What other parameters might I need to send in to get this to work?
Comment #10
capellicI figured out the reason for my problem in #9. I am using Panels. And I have Panels controlling my edit forms. For this reason the 'page callback' value is page_manager_node_add instead of node_add.
Looking at the code in ctools_automodal_menu_alter(), I see that the it's anticipated node_add as well as some others, but not page_manager_node_add.
Even if I don't have Panels managing the node form I'm trying to use, simply having the page manager enabled for node_edit will throw it off.
Comment #11
SocialNicheGuru CreditAttribution: SocialNicheGuru commenteddoes it still not work with panels as in #10?