function boxes_spaces_dashboard_block_access_alter in Boxes 7
Same name and namespace in other branches
- 6 boxes.module \boxes_spaces_dashboard_block_access_alter()
Implements hook_spaces_dashboard_block_access_alter().
Provides access to blocks specific to each space.
File
- ./
boxes.module, line 709 - Core functionality for boxes module.
Code
function boxes_spaces_dashboard_block_access_alter(&$access) {
foreach (array_keys($access) as $bid) {
list($module, $delta) = explode('-', $bid, 2);
if ($module === 'boxes') {
// This is the add block, give access to admins.
if (strpos($delta, 'boxes_add__') === 0) {
$access[$bid] = boxes_access_admin();
}
elseif (module_exists('spaces') && ($space = spaces_get_space())) {
$in_space = $space->controllers->boxes
->get($delta, 'space');
$access[$bid] = $access[$bid] || !empty($in_space);
}
else {
$access[$bid] = boxes_access_admin();
}
}
}
}