Skip to content

Instantly share code, notes, and snippets.

@ygerasimov
Created February 19, 2014 08:06
Show Gist options
  • Save ygerasimov/9087874 to your computer and use it in GitHub Desktop.
Save ygerasimov/9087874 to your computer and use it in GitHub Desktop.
Contextual link preprocess taxonomy term
<?php
/**
* Preprocess function.
*/
function example_preprocess_taxonomy_term(&$vars) {
if ($vars['vocabulary_machine_name'] == 'service_category') {
$contextual_links = array(
'#type' => 'contextual_links',
'#contextual_links' => array(
'taxonomy' => array('taxonomy/term', array($vars['tid'])),
),
);
$vars['title_suffix']['contextual_links'] = $contextual_links;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment