You are here

public function PanelizerPattern::getDefaultContexts in Panelizer 8.3

Same name and namespace in other branches
  1. 8.5 src/Plugin/PanelsPattern/PanelizerPattern.php \Drupal\panelizer\Plugin\PanelsPattern\PanelizerPattern::getDefaultContexts()
  2. 8.4 src/Plugin/PanelsPattern/PanelizerPattern.php \Drupal\panelizer\Plugin\PanelsPattern\PanelizerPattern::getDefaultContexts()

File

src/Plugin/PanelsPattern/PanelizerPattern.php, line 18

Class

PanelizerPattern
Plugin annotation @PanelsPattern("panelizer");

Namespace

Drupal\panelizer\Plugin\PanelsPattern

Code

public function getDefaultContexts(SharedTempStoreFactory $tempstore, $tempstore_id, $machine_name) {
  $contexts = [];
  list($entity_type, $bundle) = explode('__', $machine_name);
  $entity_definition = new ContextDefinition("entity:{$entity_type}", $this
    ->t('Entity being panelized'));
  $contexts['@panelizer.entity_context:entity'] = new Context($entity_definition);
  $user_definition = new ContextDefinition("entity:user", $this
    ->t('Current user'));
  $contexts['current_user'] = new Context($user_definition);
  return $contexts + parent::getDefaultContexts($tempstore, $tempstore_id, $machine_name);
}