You are here

public function PanelizerEntityDefault::get_default_panelizer_object in Panelizer 7.3

Same name and namespace in other branches
  1. 7.2 plugins/entity/PanelizerEntityDefault.class.php \PanelizerEntityDefault::get_default_panelizer_object()

Load the named default display for the bundle.

Overrides PanelizerEntityInterface::get_default_panelizer_object

3 calls to PanelizerEntityDefault::get_default_panelizer_object()
PanelizerEntityDefault::hook_entity_insert in plugins/entity/PanelizerEntityDefault.class.php
PanelizerEntityDefault::hook_entity_update in plugins/entity/PanelizerEntityDefault.class.php
PanelizerEntityDefault::hook_field_attach_submit in plugins/entity/PanelizerEntityDefault.class.php

File

plugins/entity/PanelizerEntityDefault.class.php, line 2892
Base class for the Panelizer Entity plugin.

Class

PanelizerEntityDefault
Base class for the Panelizer Entity plugin.

Code

public function get_default_panelizer_object($bundle, $name) {
  if (strpos($bundle, '.') !== FALSE) {
    list($bundle, $view_mode) = explode('.', $bundle);
  }
  else {
    $view_mode = 'page_manager';
  }

  // If the name is not in the format of entitytype:bundle:name which is
  // the machine name used, split that out automatically.
  if (strpos($name, ':') === FALSE) {
    $name = implode(':', array(
      $this->entity_type,
      $bundle,
      'default',
    ));

    // This is the default view mode and older defaults won't have this,
    // so we don't enforce it.
    if ($view_mode != 'page_manager') {
      $name .= ':' . $view_mode;
    }
  }
  ctools_include('export');
  $panelizer = ctools_export_load_object('panelizer_defaults', 'names', array(
    $name,
  ));
  return reset($panelizer);
}