protected function PanelizerDefaultPanelsStorage::getEntityContext in Panelizer 8.4
Same name and namespace in other branches
- 8.5 src/Plugin/PanelsStorage/PanelizerDefaultPanelsStorage.php \Drupal\panelizer\Plugin\PanelsStorage\PanelizerDefaultPanelsStorage::getEntityContext()
- 8.3 src/Plugin/PanelsStorage/PanelizerDefaultPanelsStorage.php \Drupal\panelizer\Plugin\PanelsStorage\PanelizerDefaultPanelsStorage::getEntityContext()
Returns the entity context.
Wraps creating new Context objects to avoid typed data in tests.
Parameters
string $entity_type_id: The entity type id.
\Drupal\Core\Entity\EntityInterface|NULL $entity: The entity.
Return value
\Drupal\Core\Plugin\Context\Context[] The available contexts.
1 call to PanelizerDefaultPanelsStorage::getEntityContext()
- PanelizerDefaultPanelsStorage::load in src/
Plugin/ PanelsStorage/ PanelizerDefaultPanelsStorage.php
File
- src/
Plugin/ PanelsStorage/ PanelizerDefaultPanelsStorage.php, line 123
Class
- PanelizerDefaultPanelsStorage
- Panels storage service that stores Panels displays in Panelizer defaults.
Namespace
Drupal\panelizer\Plugin\PanelsStorageCode
protected function getEntityContext($entity_type_id, EntityInterface $entity = NULL) {
$contexts = [];
// Set a placeholder context so that the calling code knows that we need
// an entity context. If we have the value available, then we actually set
// the context value.
$contexts['@panelizer.entity_context:entity'] = new AutomaticContext(EntityContextDefinition::fromEntityTypeId($entity_type_id), $entity);
return $contexts;
}