You are here

public function PanelizerDefaultPanelsStorage::load in Panelizer 8.4

Same name and namespace in other branches
  1. 8.5 src/Plugin/PanelsStorage/PanelizerDefaultPanelsStorage.php \Drupal\panelizer\Plugin\PanelsStorage\PanelizerDefaultPanelsStorage::load()
  2. 8.3 src/Plugin/PanelsStorage/PanelizerDefaultPanelsStorage.php \Drupal\panelizer\Plugin\PanelsStorage\PanelizerDefaultPanelsStorage::load()

File

src/Plugin/PanelsStorage/PanelizerDefaultPanelsStorage.php, line 137

Class

PanelizerDefaultPanelsStorage
Panels storage service that stores Panels displays in Panelizer defaults.

Namespace

Drupal\panelizer\Plugin\PanelsStorage

Code

public function load($id) {
  try {
    list($entity_type_id, $bundle, $view_mode, $name, $entity) = $this
      ->parseId($id);
    if ($panels_display = $this->panelizer
      ->getDefaultPanelsDisplay($name, $entity_type_id, $bundle, $view_mode)) {
      $contexts = $this
        ->getEntityContext($entity_type_id, $entity);
      $contexts = $contexts + $this->panelizer
        ->getDisplayStaticContexts($name, $entity_type_id, $bundle, $view_mode);
      $panels_display
        ->setContexts($contexts);
      return $panels_display;
    }
  } catch (PanelizerException $e) {

    // Do nothing to fallback on returning NULL.
  }
}