I need to modify the node content Array before it is rendered into html.
For this reason I cannot use the $content variable in my node template. I’m looking for it in template.php file, but I cannot find it.
thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
AFAIK, you can not access the unrendered node content array from within a theme, as the theme processing occurs to late in the processing cycle (i.e. the content array will already be rendered as you observed).
The standard way to access and modify the node content array before it gets rendered would be to implement
hook_nodeapi()within a custom module, reacting to the ‘view’ operation. This gets invoked after the content array has been assembled, but before it gets rendered, allowing you to adjust it at will.Be aware that other modules might do this as well – if that is the case and you want to adjust values provided by other modules, the call order of the modules becomes relevant and you might need to adjust your modules weight to ensure it gets called after the others.