Hi,
I used the following code for retrieving a node create/edit form inside a block
$node = node_load(arg(1));
module_load_include('inc', 'node', 'node.pages');
return drupal_get_form($node->type .'_node_form', $node);
And i got an error alert message of "Invalid response from server". Then I dived a bit into the code and found that inside hierarchical_select.module:287
some parameters are being loaded from the cache - from a Dynamic form_id. My missing parameter is $storage['file'] = 'modules/node/node.pages.inc'; hierarchical_select.module:302.
I added it manually and it works fine now. I didn't find a way to pass this parameter.
My solution for my case is to add the node.pages.inc file if $storage['file'] is empty. I didn't find a way to pass this file parameter externally.
I attached a patch with my change, tell me please if there's other solution.
| Comment | File | Size | Author |
|---|---|---|---|
| hierarchical_select.module.patch | 547 bytes | shua |
Comments
Comment #1
wim leersYou almost found it. It's the same as for CTools:
So you should do this in your form code:
Then it should work.
Comment #2
shua commentedThanks
Comment #3
wim leersYou're welcome :)
This needs to be documented better.
Comment #4
Bilmar commentedsubscribing
Comment #5
wim leersDone.
http://drupal.org/cvs?commit=335096
Comment #7
ahallez commentedHi all,
It is not clear to me where exactly this should be added.
I added $form_state['form_load_files'] = array(drupal_get_path('module', 'ip') . 'ip/r2s.injury.inc');
in the function that builds the form, but it doesn't work.
When I check the $form_state that is available in hierarchical_select_json(), it doesn't have this entry, so the file is not included.
Where do I put the code such that the information is available in the json call back?