-
Notifications
You must be signed in to change notification settings - Fork 7
/
template.block-editing.inc
77 lines (73 loc) · 2.53 KB
/
template.block-editing.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
// $Id$
/**
* @file
* Contains functions only needed if the user has block editing permissions.
*/
/**
* Add block editing variables into the block templates.
*
* @param $vars
* An array of variables to pass to the theme template.
* @param $hook
* The name of the template being rendered ("block" in this case.)
*/
function SimplyCivi_preprocess_block_editing(&$vars, $hook) {
$block = $vars['block'];
// Display 'edit block' for custom blocks.
if ($block->module == 'block') {
$edit_links[] = l('<span>' . t('[Edit Block]') . '</span>', 'admin/build/block/configure/' . $block->module . '/' . $block->delta,
array(
'attributes' => array(
'title' => t('Edit the content of this block.'),
'class' => 'block-edit',
),
'query' => drupal_get_destination(),
'html' => TRUE,
)
);
}
// Display 'configure' for other blocks.
else {
$edit_links[] = l('<span>' . t('[Configure]') . '</span>', 'admin/build/block/configure/' . $block->module . '/' . $block->delta,
array(
'attributes' => array(
'title' => t('Configure this block.'),
'class' => 'block-config',
),
'query' => drupal_get_destination(),
'html' => TRUE,
)
);
}
// Display 'edit menu' for Menu blocks.
if (($block->module == 'menu' || ($block->module == 'user' && $block->delta == 1)) && user_access('administer menu')) {
$menu_name = ($block->module == 'user') ? 'navigation' : $block->delta;
$edit_links[] = l('<span>' . t('[Edit menu]') . '</span>', 'admin/build/menu-customize/' . $menu_name,
array(
'attributes' => array(
'title' => t('Edit the menu that defines this block.'),
'class' => 'block-edit-menu',
),
'query' => drupal_get_destination(),
'html' => TRUE,
)
);
}
// Display 'edit menu' for Menu block blocks.
elseif ($block->module == 'menu_block' && user_access('administer menu')) {
$menu_name = variable_get('menu_block_' . $block->delta . '_menu_name', 'navigation');
$edit_links[] = l('<span>' . t('[Edit menu]') . '</span>', 'admin/build/menu-customize/' . $menu_name,
array(
'attributes' => array(
'title' => t('Edit the menu that defines this block.'),
'class' => 'block-edit-menu',
),
'query' => drupal_get_destination(),
'html' => TRUE,
)
);
}
$vars['edit_links_array'] = $edit_links;
$vars['edit_links'] = '<div class="edit">' . implode(' ', $edit_links) . '</div>';
}