Skip to content

Instantly share code, notes, and snippets.

@petebarnett
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petebarnett/9414025 to your computer and use it in GitHub Desktop.
Save petebarnett/9414025 to your computer and use it in GitHub Desktop.
<?php
template_preprocess_node(&$vars) {
$field_name = 'your_entityreference_field';
$nid = $vars['content'][$field_name]['#items'][0]['target_id'];
// Add a flag to the referenced node for theming
$vars['content'][$field_name][0]['node'][$nid]['#node']->some_arbitrary_flag = 'some arbitrary value';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment