You are here

function oa_core_get_space_type_layout_options in Open Atrium Core 7.2

Build a list of section layouts based on oa_section panelizer displays.

Parameters

string $bundle: The name of the bundle of layouts to scan.

Return value

array An associative array keyed by the display name and containing a human readable display name.

1 call to oa_core_get_space_type_layout_options()
_oa_core_setup_taxonomy_space_type in ./oa_core.module
Alters a taxonomy edit form to setup the 'Space Blueprint' functionality.

File

./oa_core.module, line 1702

Code

function oa_core_get_space_type_layout_options($bundle) {
  $plugins = panelizer_get_entity_plugins();
  $node_plugin = panelizer_entity_plugin_get_handler($plugins['node']);
  $options = array();
  foreach ($node_plugin->plugin['view modes'] as $view_mode => $view_mode_info) {
    $view_bundle = $bundle . '.' . $view_mode;

    // Ignore view modes that don't have a choice or already have their
    // own custom panel set up.
    if (!$node_plugin
      ->has_panel_choice($view_bundle)) {
      continue;
    }
    $panelizers = $node_plugin
      ->get_default_panelizer_objects($view_bundle);
    foreach ($panelizers as $name => $panelizer) {
      if (empty($panelizer->disabled)) {
        $options[$name] = $panelizer->title ? $panelizer->title : t('Default');
        if (!empty($panelizer->title)) {
          $thisarray = explode(':', $name);
          if (!empty($thisarray[3])) {
            $options[$name] = ucfirst($thisarray[3]) . ':' . $options[$name];
          }
        }
      }
    }
    if (!$node_plugin
      ->has_default_panel($view_bundle)) {
      $options = array(
        '' => t('-- No panel --'),
      ) + $options;
    }
  }
  return $options;
}