You are here

class PanelizerPattern in Panelizer 8.4

Same name and namespace in other branches
  1. 8.5 src/Plugin/PanelsPattern/PanelizerPattern.php \Drupal\panelizer\Plugin\PanelsPattern\PanelizerPattern
  2. 8.3 src/Plugin/PanelsPattern/PanelizerPattern.php \Drupal\panelizer\Plugin\PanelsPattern\PanelizerPattern

Plugin annotation

@PanelsPattern("panelizer");

Hierarchy

  • class \Drupal\panelizer\Plugin\PanelsPattern\PanelizerPattern extends \Drupal\panels\Plugin\PanelsPattern\DefaultPattern

Expanded class hierarchy of PanelizerPattern

1 file declares its use of PanelizerPattern
PanelizerPatternTest.php in tests/src/Unit/PanelizerPatternTest.php

File

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

Namespace

Drupal\panelizer\Plugin\PanelsPattern
View source
class PanelizerPattern extends DefaultPattern {

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

}

Members