1

Just wonder what is the difference between $variables['elements']['#node'] and $variables['node'] in hook_preprocess_node(). Are the same instance of the same node?

1
  • The part I removed was already asked in drupal.stackexchange.com/questions/251914/… which was closed. Asking where to find documentation is off-topic for us, together any question asking where to find off-site resources. We assume you know of api.drupal.org and the documentation on drupal.org.
    – apaderno
    Dec 12, 2017 at 14:00

1 Answer 1

2

See the code executed in template_preprocess_node(), the function called before the preprocess functions implemented by modules for a node.

$variables['node'] = $variables['elements']['#node']; 

So, yes, $variables['node'] and $variables['elements']['#node'] contain the same value.

2
  • Why you removed my question on $variables variable. It seems this forum is over moderated.
    – Paul Paku
    Dec 12, 2017 at 12:46
  • The Where do I find more documentation? part is off-topic for us, but you find the answer in the answer I posted. Also, this is not a forum, but a Q&A site.
    – apaderno
    Dec 12, 2017 at 13:55

Your Answer

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

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