790b01e199b75709e5f2466646356a64edb0a4de
6 * Contains functions only needed if the user has block editing permissions.
10 * Add block editing variables into the block templates.
13 * An array of variables to pass to the theme template.
15 * The name of the template being rendered ("block" in this case.)
17 function zen_preprocess_block_editing(&$vars, $hook) {
18 $block = $vars['block'];
20 // Display 'edit block' for custom blocks.
21 if ($block->module
== 'block') {
22 $edit_links[] = l('<span>' .
t('edit block') .
'</span>', 'admin/build/block/configure/' .
$block->module .
'/' .
$block->delta
,
24 'attributes' => array(
25 'title' => t('edit the content of this block'),
26 'class' => 'block-edit',
28 'query' => drupal_get_destination(),
33 // Display 'configure' for other blocks.
35 $edit_links[] = l('<span>' .
t('configure') .
'</span>', 'admin/build/block/configure/' .
$block->module .
'/' .
$block->delta
,
37 'attributes' => array(
38 'title' => t('configure this block'),
39 'class' => 'block-config',
41 'query' => drupal_get_destination(),
47 // Display 'edit view' for Views blocks.
48 if ($block->module
== 'views' && user_access('administer views')) {
49 $edit_links[] = l('<span>' .
t('edit view') .
'</span>', 'admin/build/views/' .
$block->delta .
'/edit',
51 'attributes' => array(
52 'title' => t('edit the view that defines this block'),
53 'class' => 'block-edit-view',
55 'query' => drupal_get_destination(),
56 'fragment' => 'edit-block',
61 // Display 'edit menu' for Menu blocks.
62 elseif (($block->module
== 'menu' || ($block->module
== 'user' && $block->delta
== 1)) && user_access('administer menu')) {
63 $menu_name = ($block->module
== 'user') ?
'navigation' : $block->delta
;
64 $edit_links[] = l('<span>' .
t('edit menu') .
'</span>', 'admin/build/menu-customize/' .
$menu_name,
66 'attributes' => array(
67 'title' => t('edit the menu that defines this block'),
68 'class' => 'block-edit-menu',
70 'query' => drupal_get_destination(),
75 // Display 'edit menu' for Menu block blocks.
76 elseif ($block->module
== 'menu_block' && user_access('administer menu')) {
77 list($menu_name, ) = split(':', variable_get("menu_block_{$block->delta}_parent", 'navigation:0'));
78 $edit_links[] = l('<span>' .
t('edit menu') .
'</span>', 'admin/build/menu-customize/' .
$menu_name,
80 'attributes' => array(
81 'title' => t('edit the menu that defines this block'),
82 'class' => 'block-edit-menu',
84 'query' => drupal_get_destination(),
90 $vars['edit_links_array'] = $edit_links;
91 $vars['edit_links'] = '<div class="edit">' .
implode(' ', $edit_links) .
'</div>';