public function ds_regiontoblock::block_list in Display Suite 6
Same name and namespace in other branches
- 6.2 plugins/ds_regiontoblock.inc \ds_regiontoblock::block_list()
plugin block listing.
Make sure you create a unique name for your $block_key. You should return info & plugin so ds_block knows which block to load. You can add other info, which you'll receive back in block_list.
File
- plugins/
ds_regiontoblock.inc, line 71 - DS_RegionToBlock: Plugin to make a region available as a block.
Class
- ds_regiontoblock
- @file DS_RegionToBlock: Plugin to make a region available as a block.
Code
public function block_list($module, &$blocks, $data) {
$api_info = ds_api_info($module);
$types = $api_info['types']();
if (!empty($types)) {
foreach ($types as $type_key => $object) {
$display_settings = variable_get($module . '_display_settings_' . $type_key, array());
foreach ($display_settings as $build_mode => $settings) {
if (isset($settings['regiontoblock'])) {
foreach ($settings['regiontoblock']['block'] as $region => $value) {
if ($value) {
$block_key = 'ds_regiontoblock_' . $module . '_' . $object->type . '_' . $build_mode . '_' . $region;
$block_info = $api_info['title'] . ': ' . $object->name . ', ' . $build_mode . ', ' . $region;
$blocks[] = array(
'info' => $block_info,
'key' => $block_key,
'data' => $data,
);
}
}
}
}
}
}
}