You are here

public function ds_regiontoblock::execute in Display Suite 6

Same name and namespace in other branches
  1. 6.2 plugins/ds_regiontoblock.inc \ds_regiontoblock::execute()

execute().

File

plugins/ds_regiontoblock.inc, line 112
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 execute(&$vars, &$display, $display_settings, $object_type, $module) {
  $object = $vars[$object_type];
  foreach ($display->all_regions as $region_name => $region_title) {
    $region_to_block = ds_default_value($display_settings, $display->build_mode, 'regiontoblock', 'block', $region_name, FALSE);
    if ($region_to_block == TRUE && isset($display->themed_regions[$region_name])) {
      $region_content = $display->themed_regions[$region_name];
      $key = 'ds_regiontoblock_' . $module . '_' . $object->type . '_' . $object->build_mode . '_' . $region_name;
      $data = new stdClass();
      $data->content = $region_content['content'];
      $data->object = $vars[$object_type];
      ds_static_variables($key, $data);
      unset($display->themed_regions[$region_name]);
      if ($region_name == 'left' || $region_name == 'right') {
        unset($display->region_classes[$region_name]);
      }
    }
  }
}