-1

I'm working on a client site that is Drupal 6 and many of the footer/header region areas have many blocks of text created via the blocks page. Its currently very cumbersome to go into the blocks page and find which blocks they reside in. Is there a way to show a quick "edit" hover button on these text blocks? I think D7 has this but I don't think D6 has a setup for this.

closed as too broad by kiamlaluno Jun 26 '15 at 6:25

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

1

Just miss read the requirements. I would add the user_access('Administer content') condition instead of $logged_in. Only Administer users needs to see this link. So the condition will be:if (user_access('Administer content') && is_numeric($block->delta) && $block->delta != 0 && $block->module == 'block-block')

  • yes administer_content would be more appropiate than user_logged in. points for u! =) – Patoshi パトシ Mar 3 '14 at 3:03
0

I created a custom block.tpl.php and have it insert an "edit" button on every block. Currently it checks to make sure its a real block and not some other generated block via views or panels as this edit button was showing in a bunch of random places that dynamically generated a block.

<div id="block-<?php print $block->module .'-'. $block->delta; ?>" class="block block-<?php print $block->module ?> clear-block">

<?php if ($logged_in && is_numeric($block->delta) && $block->delta != 0 && $block->module == 'block-block'): ?>
  <em class="blk-edit"><a href="<?php print '/admin/build/block/configure/block/'. $block->delta; ?>">EDIT</a></em>
<?php endif;?>

<?php if ($block->subject): ?>
  <h2 class="block-title"><?php print $block->subject ?></h2>
<?php endif;?>

  <div class="block-content clear-block">
    <?php print $block->content ?>
  </div>
</div>

This was the section I added:

<?php if ($logged_in && is_numeric($block->delta) && $block->delta != 0 && $block->module == 'block-block'): ?>


<em class="blk-edit"><a href="<?php print '/admin/build/block/configure/block/'. $block->delta; ?>">EDIT</a></em>


<?php endif;?>
  • 1
    Awesome approach. But, could you take some of the logic out of these by creating a block-block.tpl.php and allowing the existing block-MODULE.tpl.php suggestions to take place? And perhaps even go so far as to create a block-block-0.tpl.php without the EDIT in it to remove that one delta issue as well? – Jimajamma Mar 3 '14 at 1:20
0

Nice approach by duckx. I rather use Admin permissions. like this.

<?php if (user_access('Administer content')) : ?>
<em class="blk-edit"
  <?php print l(t('edit'), 'admin/build/block/configure/block' . $block->delta); ?>
</em><?php endif; ?>

Check - https://api.drupal.org/api/drupal/modules%21user%21user.module/function/user_access/6

  • thats going to show up on every dynamically generated block... which views and panels creates depending on your setup. there are also delta->0 blocks too which are not actual blocks. this is why i created the conditional to filter these out. – Patoshi パトシ Mar 3 '14 at 0:10

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