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.
By alexeyl on
Hi!
I need to alter CCK content type node form page. So I'd like to be able to render this form myself and surround it with my additions.
Here is how I do this:
$form = node_form(node_load($node_id));
$output .= drupal_render($form);
node id is correct and form is populated. But errors occur while rendering it:
* warning: implode() [function.implode]: Invalid arguments passed in xxx\includes\form.inc on line 548.
* warning: implode() [function.implode]: Invalid arguments passed in xxx\includes\form.inc on line 548.
What that could mean? how can I get this CCK form rendered?
Thank you!
Comments
It might help if you said
It might help if you said what you are trying to achieve, why/how are you trying to modify the form. Depending on your goal you probably want to theme the form and/or use hook_form_alter().
Thanks for your
Thanks for your response.
Currently I trigger this form as node/<id>/edit. But I want to output this form somewhere else inside of another page, that contains another valuable related information. Is this possible?
Also about hook_form_alter - how could I know exact id of the form from CCK? It will be just name of the type, right?
Thanks, Alex.
...
Why are you breaking the process into two steps? You're saying "and surround it with my additions", but for merely surrounding it you don't need access to $form itself.
Here's a way to do it:
It's "xyz_node_form". "xyz" stands for the the node-type.
===
And if you _do_ need access to $form, do something along of:
You shouldn't pass to drupal_render() a form that wan't built yet (by drupal_process_form()), because various values need initialization.
Great! You made my day!
Great! You made my day! ;)
Thanks for your help!
Thanks
Very cool... I try it for node creation but without success. I have nothing in $output :( and this error:
Here my code:
https://interface-network.com - Interface Network is an action and research technology governance agency.
EDIT all work now
After some test and adapte the code to D6 i have no more error. The form is returned but I have any field only:
- Revision information
- Authoring information
- Publishing options
The code:
EDIT all work with this code (stupid error in variable name):
https://interface-network.com - Interface Network is an action and research technology governance agency.