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?

  • 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. – kiamlaluno Dec 12 '17 at 14:00
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.

  • Why you removed my question on $variables variable. It seems this forum is over moderated. – Paul Paku Dec 12 '17 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. – kiamlaluno Dec 12 '17 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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