Add contextual links on node en term pages

<?php
/**
 * Implements hook_node_view_alter().
 */
function TEMPLATE_node_view_alter(&$build) {
  $node = $build['#node'];

  if (!empty($node->nid)) {
    // Add contexual links for nodes.
    $build['#contextual_links']['node'] = array('node', array($node->nid));
  }
}

/**
 * Implements hook_node_view_alter().
 */
function TEMPLATE_taxonomy_term_view_alter(&$build) {
  $term = $build['#term'];
  if (!empty($term->tid)) {
    $build['#contextual_links']['taxonomy'] = array('taxonomy/term', array($term->tid));
  }
}

/**
 * Implements hook_menu_alter().
 */
function TEMPLATE_menu_alter(&$items) {
  // Needed to make contextual links available for taxonomy term pages.
  $items['taxonomy/term/%taxonomy_term/edit']['context'] = MENU_CONTEXT_INLINE;
}
?>

Reactie toevoegen

Plaats hier uw naam.