public function Panelizer::getDefaultPanelsDisplays in Panelizer 8.5
Same name and namespace in other branches
- 8.3 src/Panelizer.php \Drupal\panelizer\Panelizer::getDefaultPanelsDisplays()
- 8.4 src/Panelizer.php \Drupal\panelizer\Panelizer::getDefaultPanelsDisplays()
Gets the default Panels displays for an entity type, bundle and view mode.
Parameters
string $entity_type_id: The entity type id.
string $bundle: The bundle.
string $view_mode: The view mode.
\Drupal\Core\Entity\Display\EntityViewDisplayInterface|NULL $display: If the caller already has the correct display, it can optionally be passed in here so the Panelizer service doesn't have to look it up; otherwise, this argument can bo omitted.
Return value
\Drupal\panels\Plugin\DisplayVariant\PanelsDisplayVariant[] An associative array of Panels displays, keyed by the machine name of the default if panelized; NULL otherwise. All panelized view modes will have at least one named 'default'.
Overrides PanelizerInterface::getDefaultPanelsDisplays
1 call to Panelizer::getDefaultPanelsDisplays()
- Panelizer::getPanelsDisplay in src/Panelizer.php 
- Gets the Panels display for a given entity and view mode.
File
- src/Panelizer.php, line 337 
Class
- Panelizer
- The Panelizer service.
Namespace
Drupal\panelizerCode
public function getDefaultPanelsDisplays($entity_type_id, $bundle, $view_mode, EntityViewDisplayInterface $display = NULL) {
  if (!$display) {
    $display = $this
      ->getEntityViewDisplay($entity_type_id, $bundle, $view_mode);
  }
  // Get a list of all the defaults.
  $display_config = $display
    ->getThirdPartySetting('panelizer', 'displays', []);
  $display_names = array_keys($display_config);
  if (empty($display_names)) {
    $display_names = [
      'default',
    ];
  }
  // Get each one individually.
  $panels_displays = [];
  foreach ($display_names as $name) {
    if ($panels_display = $this
      ->getDefaultPanelsDisplay($name, $entity_type_id, $bundle, $view_mode, $display)) {
      $panels_displays[$name] = $panels_display;
    }
  }
  return $panels_displays;
}