You are here

function ds_get_layout_info in Display Suite 7

Same name and namespace in other branches
  1. 7.2 ds.module \ds_get_layout_info()

Get Display suite layouts.

5 calls to ds_get_layout_info()
ds_field_ui_layouts_save in ./ds.field_ui.inc
Save the layout settings from the 'Manage display' screen.
ds_field_ui_layout_change in ./ds.field_ui.inc
Change a layout for a given entity.
_ds_entity_info_alter in ./ds.registry.inc
Implements hook_entity_info_alter().
_ds_field_ui_table_layouts in ./ds.field_ui.inc
Add the layouts fieldset on the Field UI screen.
_ds_theme in ./ds.registry.inc
Implements hook_theme().

File

./ds.module, line 432
Display Suite core functions.

Code

function ds_get_layout_info() {
  static $layouts = FALSE;
  if (!$layouts) {
    $errors = array();
    $layouts = module_invoke_all('ds_layout_info');

    // Give modules a chance to alter the layouts information.
    drupal_alter('ds_layout_info', $layouts);

    // Check that there is no 'content' region, but ignore panel layouts.
    // Because when entities are rendered, the field items are stored into a
    // 'content' key so fields would be overwritten before they're all moved.
    foreach ($layouts as $key => $info) {
      if (isset($info['panels'])) {
        continue;
      }
      if (isset($info['regions']['content'])) {
        $errors[] = $key;
      }
    }
    if (!empty($errors)) {
      drupal_set_message(t('Following layouts have a "content" region key which is invalid: %layouts.', array(
        '%layouts' => implode(', ', $errors),
      )), 'error');
    }
  }
  return $layouts;
}