simplify administration
Add an "Edit" Tab to Every Block
Task · blocks · edit blocks · simplify administration · Site administrators · Themers · Drupal 6.x · No known problems
Last modified: August 18, 2009 - 05:48
This snippet builds on another snippet about "Add an Edit this Block link". Instead of a link this goes further to have the edit link look like the tabs for View, Edit, etc. Here is the code to include in your theme's block.tpl.php file:
<div id="block-<?php print $block->module .'-'. $block->delta; ?>" class="clear-block block block-<?php print $block->module ?>">
<?php
if ($block->module == 'block'):
if (user_access('administer blocks')) :?>
<div id="tabs-wrapper">
<ul class="tabs primary">
<li class="active">
<a class="active" href='<?php print check_url(base_path()) ?>admin/build/block/configure/<?php print $block->module;?>/<?php print $block->delta;?>'>Edit</a>
</li>
</ul>
</div>
<?php
endif;
endif;
?>
<?php if (!empty($block->subject)): ?>
<h2><?php print $block->subject ?></h2>
<?php endif;?>
<div class="content"><?php print $block->content ?></div>
</div>If the core style sheets are being loaded this should produce an "Edit" tab above each block for users who have "administer blocks" privileges.
