Skip to content

Instantly share code, notes, and snippets.

@jodyHamilton
Created July 7, 2017 15:56
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 jodyHamilton/5ef3f61d8cc53468f0abd25c1b0656c8 to your computer and use it in GitHub Desktop.
Save jodyHamilton/5ef3f61d8cc53468f0abd25c1b0656c8 to your computer and use it in GitHub Desktop.
<?php
/**
* Implements template_preprocess_node().
*/
function favorite_preprocess_node(&$variables) {
$node = $variables['node'];
if ($variables['view_mode'] == 'full') {
$variables['#attached']['library'][] = 'favorite/favorite';
$variables['content']['favorite'] = array(
'#markup' => '<div id="favorite"></div>',
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment