You are here

public function Panelizer::getDisplayStaticContexts in Panelizer 8.3

Same name and namespace in other branches
  1. 8.5 src/Panelizer.php \Drupal\panelizer\Panelizer::getDisplayStaticContexts()
  2. 8.4 src/Panelizer.php \Drupal\panelizer\Panelizer::getDisplayStaticContexts()

Overrides PanelizerInterface::getDisplayStaticContexts

File

src/Panelizer.php, line 416

Class

Panelizer
The Panelizer service.

Namespace

Drupal\panelizer

Code

public function getDisplayStaticContexts($name, $entity_type_id, $bundle, $view_mode, EntityViewDisplayInterface $display = NULL) {
  if (!$display) {
    $display = $this
      ->getEntityViewDisplay($entity_type_id, $bundle, $view_mode);

    // If we still don't find a display, then we won't find a Panelizer
    // default for sure.
    if (!$display) {
      return NULL;
    }
  }
  $config = $display
    ->getThirdPartySetting('panelizer', 'displays', []);
  if (!empty($config[$name]) && !empty($config[$name]['static_context'])) {
    return $this->contextMapper
      ->getContextValues($config[$name]['static_context']);
  }
  return [];
}