I have added a text field (field_title_alt) to a node type. If the field_title_alt is edited, I want to replace the value of the default node title with the value of field_title_alt. I have tried implementing preprocess_node, but I cant make it work. Please help, Im sure this is really easy.

http://pastebin.com/MmqinV4q

Comments

swentel’s picture

Status: Active » Closed (fixed)

That field_title_alt won't be in $vars['field_title_alt']; It will be somewhere in $vars['content']['field_title_alt'];

Try using the devel module and use the 'dsm' function inside your php code to inspect the $vars variable, that will give you a nice overview what's available.