class SectionStorage

Same name in this branch
  1. 10 core/modules/layout_builder/src/Annotation/SectionStorage.php \Drupal\layout_builder\Annotation\SectionStorage
Same name and namespace in other branches
  1. 9 core/modules/layout_builder/src/Annotation/SectionStorage.php \Drupal\layout_builder\Annotation\SectionStorage
  2. 8.9.x core/modules/layout_builder/src/Annotation/SectionStorage.php \Drupal\layout_builder\Annotation\SectionStorage
  3. 11.x core/modules/layout_builder/src/Annotation/SectionStorage.php \Drupal\layout_builder\Annotation\SectionStorage
  4. 11.x core/modules/layout_builder/src/Attribute/SectionStorage.php \Drupal\layout_builder\Attribute\SectionStorage

Defines a SectionStorage attribute.

Plugin Namespace: Plugin\SectionStorage

Hierarchy

  • class \Drupal\layout_builder\Attribute\SectionStorage implements \Drupal\Component\Plugin\Attribute\Plugin

Expanded class hierarchy of SectionStorage

See also

\Drupal\layout_builder\SectionStorage\SectionStorageManager

Plugin API

6 files declare their use of SectionStorage
DefaultsSectionStorage.php in core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php
NavigationSectionStorage.php in core/modules/navigation/src/Plugin/SectionStorage/NavigationSectionStorage.php
OverridesSectionStorage.php in core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php
SectionStorageManager.php in core/modules/layout_builder/src/SectionStorage/SectionStorageManager.php
SimpleConfigSectionStorage.php in core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/SimpleConfigSectionStorage.php

... See full list

File

core/modules/layout_builder/src/Attribute/SectionStorage.php, line 16

Namespace

Drupal\layout_builder\Attribute
View source
class SectionStorage extends Plugin {
  
  /**
   * Constructs a SectionStorage attribute.
   *
   * @param string $id
   *   The plugin ID.
   * @param int $weight
   *   (optional) The plugin weight.
   *   When an entity with layout is rendered, section storage plugins are
   *   checked, in order of their weight, to determine which one should be used
   *   to render the layout.
   * @param \Drupal\Component\Plugin\Context\ContextDefinitionInterface[] $context_definitions
   *   (optional) Any required context definitions.
   *   When an entity with layout is rendered, all section storage plugins which
   *   match a particular set of contexts are checked, in order of their weight,
   *   to determine which plugin should be used to render the layout.
   *   @see \Drupal\layout_builder\SectionStorage\SectionStorageManagerInterface::findByContext()
   * @param bool $handles_permission_check
   *   (optional) Indicates that this section storage handles its own
   *   permission checking. If FALSE, the 'configure any layout' permission
   *   will be required during routing access. If TRUE, Layout Builder will
   *   not enforce any access restrictions for the storage, so the section
   *   storage's implementation of access() must perform the access checking itself.
   * @param string|null $deriver
   *   (optional) The deriver class.
   */
  public function __construct(public readonly string $id, public readonly int $weight = 0, public readonly array $context_definitions = [], public readonly bool $handles_permission_check = FALSE, public readonly ?string $deriver = NULL) {
  }
  
  /**
   * {@inheritdoc}
   */
  public function get() : SectionStorageDefinition {
    return new SectionStorageDefinition([
      'id' => $this->id,
      'class' => $this->class,
      'weight' => $this->weight,
      'context_definitions' => $this->context_definitions,
      'handles_permission_check' => $this->handles_permission_check,
    ]);
  }

}

Members

Title Sort descending Modifiers Object type Summary
SectionStorage::get public function
SectionStorage::__construct public function Constructs a SectionStorage attribute.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.