You are here

function panopoly_pages_get_panelizer_entity in Panopoly Pages 8.2

Gets the Panelizer entity from a Panels display.

Parameters

\Drupal\panels\Plugin\DisplayVariant\PanelsDisplayVariant $panels_display: The Panels display.

Return value

\Drupal\Core\Entity\EntityInterface|null The entity if this is a Panelizer display; NULL otherwise.

2 calls to panopoly_pages_get_panelizer_entity()
panopoly_pages_panels_ipe_blocks_alter in ./panopoly_pages.module
Implements hook_panels_ipe_blocks_alter().
panopoly_pages_panels_ipe_layouts_alter in ./panopoly_pages.module
Implements hook_panels_ipe_layouts_alter().

File

./panopoly_pages.module, line 19
Hook implementations for Panopoly Pages.

Code

function panopoly_pages_get_panelizer_entity(PanelsDisplayVariant $panels_display) {
  $contexts = $panels_display
    ->getContexts();
  if (isset($contexts['@panelizer.entity_context:entity'])) {
    return $contexts['@panelizer.entity_context:entity']
      ->getContextValue();
  }
}