By fax8 on
Hi everybody!
I need to set the title of a node from other fields provided
by a custom module created by me.
The custom module has two fields called number and name.
How do I set the node title to be 'number . name' ?
thank you.
Fabio
Comments
do you want to....
... actually set the title field (which will be stored in the database), or just to display it in nodes?
to set the title of the current page, you can use drupal_set_title
for actually storing it in the databse, take a look at hook_validate
I need to store the created
I need to store the created title in the node table.
hook_validate was ok for drupal 4.6 but I heard that in 4.7 changing
node field in the validate hook is forbidden.
then I tryed to use hook_execute writing something like:
function mynode_execute(&$node) {$node->title = $node->fieldA . $node->fieldB;
}
but I was not luky with this.
hook_execute is hook_submit
change mynode_execute to mynode_submit and you should be okay to go. hook_execute doesn't exist (but it seems that it must have for a short amount of time).
-------
http://www.funnymonkey.com
Tools for Teachers
perfect... Thank you marcp!
perfect...
Thank you marcp! I solved my problem!
Thank you!
I used hook_execute becouse
I used hook_execute becouse of the documentation of
http://cvs.drupal.org/viewcvs/drupal/contributions/docs/developer/hooks/...
were it's reported as a valid hook.
I don't know if it's an error on documentation or else
As
As for
http://drupal.org/node/39576
hook execute doesn't exist enymore.
I will do a documentation issue report for this.
Fabio