function boxes_context_block_info_alter in Boxes 7
Same name and namespace in other branches
- 6 boxes.module \boxes_context_block_info_alter()
Implements hook_context_block_info_alter().
Provides spaces integration when working with blocks using context.
File
- ./
boxes.module, line 736 - Core functionality for boxes module.
Code
function boxes_context_block_info_alter(&$blocks) {
// Add boxes JS. If this is getting called, it's highly likely a context
// inline editor is on the page.
boxes_add_js();
if (module_exists('spaces') && ($space = spaces_get_space())) {
$item = menu_get_item();
// Prevent space-specific blocks from appearing on the dashboard settings
// page within a space.
if (!(isset($item['page_callback'], $item['page_arguments'][0]) && $item['page_callback'] === 'drupal_get_form' && $item['page_arguments'][0] === 'spaces_dashboard_admin_form')) {
foreach ($space->controllers->boxes
->get() as $box) {
$add = new stdClass();
$add->bid = "boxes-{$box->delta}";
$add->delta = $box->delta;
$add->info = $box->description;
$add->cache = DRUPAL_CACHE_CUSTOM;
$add->module = 'boxes';
$blocks[$add->bid] = $add;
}
}
}
}