I have a content type with multiple fields.

On the node display page I want to do some modification on this node (like. changing label text etc.) and I want to do it for display only. Nothing should change in the database.

I want to know how can I do this? Where exactly can I catch the current node object and make changes into it before it is rendered?

2 Answers 2



This hook is called after the content has been assembled in a structured array and may be used for doing processing which requires that the complete node content structure has been built.

If the module wishes to act on the rendered HTML of the node rather than the structured content array, it may use this hook to add a #post_render callback. Alternatively, it could also implement hook_preprocess_node(). See drupal_render() and theme() documentation respectively for details.


You should use the preprocess hook for this task.

For example, you can add in your theme :

function yourtheme_preprocess_node(&$variables) {

  if ($variables['view_mode'] == 'full' && $variables['node']->type == 'your_node_type') {
    // Change the $variables['node'] whatever you want here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.