You are here

public function OverridesSectionStorage::getContextsDuringPreview in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php \Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage::getContextsDuringPreview()

Gets contexts for use during preview.

When not in preview, ::getContexts() will be used.

Return value

\Drupal\Core\Plugin\Context\ContextInterface[] The plugin contexts suitable for previewing.

Overrides SectionStorageBase::getContextsDuringPreview

File

core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php, line 346

Class

OverridesSectionStorage
Defines the 'overrides' section storage type.

Namespace

Drupal\layout_builder\Plugin\SectionStorage

Code

public function getContextsDuringPreview() {
  $contexts = parent::getContextsDuringPreview();

  // @todo Remove this in https://www.drupal.org/node/3018782.
  if (isset($contexts['entity'])) {
    $contexts['layout_builder.entity'] = $contexts['entity'];
    unset($contexts['entity']);
  }
  return $contexts;
}