You are here

function ds_extras_ds_layout_region_alter in Display Suite 7

Same name and namespace in other branches
  1. 8.2 modules/ds_extras/ds_extras.module \ds_extras_ds_layout_region_alter()
  2. 8.3 modules/ds_extras/ds_extras.module \ds_extras_ds_layout_region_alter()
  3. 7.2 modules/ds_extras/ds_extras.module \ds_extras_ds_layout_region_alter()

Implements hook_ds_layout_region_alter().

File

modules/ds_extras/ds_extras.module, line 719
Display Suite extras main functions.

Code

function ds_extras_ds_layout_region_alter($context, &$region_info) {
  $region_blocks = variable_get('ds_extras_region_blocks', array());

  // Bail out if region_blocks is empty or we are working on default view mode.
  if (empty($region_blocks) || $context['view_mode'] == 'default') {
    return;
  }
  $entity_type = $context['entity_type'];
  $bundle = $context['bundle'];
  $view_mode = $context['view_mode'];
  foreach ($region_blocks as $block_key => $block) {
    if ($block['info'] == "{$entity_type}_{$bundle}_{$view_mode}") {
      $region_info['region_options'][$block_key] = $block['title'];
      if (isset($region_info['table_regions'])) {
        $region_info['table_regions'][$block_key] = array(
          'title' => check_plain($block['title']),
          'message' => t('No fields are displayed in this region'),
        );
      }
    }
  }
}