1

I need to be able to display my contextual links in the node full content view mode. How can I achieve this? Maybe something in my node.tpl?

2
  • you want to display contextual links for nodes or for a view page? – Aboodred1 Jun 7 '13 at 19:35
  • I want to use it for nodes. I have revised my question to remove the ambiguity. – silly_monkey Jun 7 '13 at 20:36
1

if you want to show contextual link on a node view try out this code on your custom module file.

function mymodulename_node_view_alter(&$build) {
  $node = $build['#node'];
  if (!empty($node->nid)) {
    $build['#contextual_links']['node'] = array('node', array($node->nid));
  }
}
2
  • Anyway of printing this in the tpl without having to make and enable a simple module to achieve this? – silly_monkey Jun 7 '13 at 20:40
  • drupal.org/node/951088#comment-4350170 worked for me with few css changes to make the link display as block on mouse hover.the code needs to be placed at template.php of your theme – arpitr Jun 7 '13 at 21:15

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.