[support] The best place to edit the node title?

Augustin (Beginner) drupal.beginner at wechange.org
Thu Sep 13 09:41:02 UTC 2007


On Thursday 13 September 2007 16:30, Augustin (Beginner) wrote:
> Where is the best place for a module/theme to edit the node title?
> I would like to prepend the node type to the title input by the user.
>
>
>
> I have custom node types created with hook_*().
> I tried to set $node->title in hook_view(), but it doesn't affect anything.


Well. I finally used the following solution: 

I added an item in the node object within hook_load():
$node->title_prepend = "what I want here";

and then at the theme level:

<?php if ($node->title_prepend): print '<span class="node-label">'. 
$node->title_prepend .' </span>'; endif; ?>


It works.
If there is a better solution, I'd be happy to hear about it.

thanks,

Augustin.


More information about the support mailing list