I have contextual links enabled. I've added

print render($action_links);

to both my page template and every block template I have but it's always blank. Out of desperation, I set permissions to allow even anonymous users. Still nothing.

I read that Devel might mess with contextual links but I don't have it enabled.


<?php print render($title_suffix); ?>
<?php print render($action_links); ?>
<div style="border: 1px solid #044faa">
   <div style="background: #044faa; color: #fff; padding: 5px 15px; font-size: 16px"><strong><?php echo $block->title; ?></strong></div>

   <div style="padding: 5px 0; text-align: center"><?php
   echo preg_replace("/(<)[\/]?[p](>)/is", "", $content);
  • How do you know $action_links is defined as variable for template? Nov 3, 2015 at 11:13
  • I didn't see anything that mentioned it having to be defined in the template so I figured it was one of drupal's predefined variables.
    – jsalita
    Nov 4, 2015 at 0:13

2 Answers 2


Contextual links are printed with:

print render($title_suffix);

I Have checked it on block.tpl.php

See: Working with contextual links

I would suggest not to put inline css in your template. Here working code:

<div id="<?php print $block_html_id; ?>" class="<?php print $classes; ?> clearfix" <?php print $attributes; ?>>
  <?php print render($title_prefix); ?>
  <?php if ($title): ?>
    <div <?php print $title_attributes; ?> style="background: #044faa; color: #fff; padding: 5px 15px; font-size: 16px">
     <strong><?php print $title; ?></strong>
  <?php endif; ?>
  <?php print render($title_suffix); ?>
  <div style="border: 1px solid #044faa">
    <div style="padding: 5px 0; text-align: center">
      <?php print preg_replace("/(<)[\/]?[p](>)/is", "", $content); ?>

  • I've also already added that. The value is always blank.
    – jsalita
    Nov 6, 2015 at 8:13
  • Post the code from your template Nov 6, 2015 at 8:19
  • code added to the post.
    – jsalita
    Nov 6, 2015 at 8:25
  • check my last edit Nov 6, 2015 at 8:56
  • I have a feeling that I wrecked something somewhere else in my code because that isn't working, either. I think I'll just cheat because all I need is a link to the configure block area for the selected block and everything I need to do get the needed url is already in the template.
    – jsalita
    Nov 6, 2015 at 9:06

I wish I could add this as a comment but I don't have enough reputation.

In your Chrome or Firefox tools, delete any custom css you've added that could cause them to not show.

I've managed to make this mistake before and also helped someone on /r/drupal who had done the same.

  • They're not hidden via css. I've checked the source and they're just not there.
    – jsalita
    Nov 6, 2015 at 8:15
  • Ah ok. And if you switch back to garland, do they show? Nov 6, 2015 at 9:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.