You are here

class SectionStorage in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/src/Annotation/SectionStorage.php \Drupal\layout_builder\Annotation\SectionStorage

Defines a Section Storage type annotation object.

Hierarchy

Expanded class hierarchy of SectionStorage

See also

\Drupal\layout_builder\SectionStorage\SectionStorageManager

Plugin API

Related topics

1 file declares its use of SectionStorage
SectionStorageManager.php in core/modules/layout_builder/src/SectionStorage/SectionStorageManager.php
2 classes are annotated with SectionStorage
SimpleConfigSectionStorage in core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/SimpleConfigSectionStorage.php
Provides section storage utilizing simple config.
TestStateBasedSectionStorage in core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/TestStateBasedSectionStorage.php
Provides a test section storage that is controlled by state.

File

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

Namespace

Drupal\layout_builder\Annotation
View source
class SectionStorage extends Plugin {

  /**
   * The plugin ID.
   *
   * @var string
   */
  public $id;

  /**
   * The plugin weight, optional (defaults to 0).
   *
   * 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.
   *
   * @var int
   */
  public $weight = 0;

  /**
   * Any required context definitions, optional.
   *
   * 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.
   *
   * @var array
   *
   * @see \Drupal\layout_builder\SectionStorage\SectionStorageManagerInterface::findByContext()
   */
  public $context_definitions = [];

  /**
   * 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. Defaults to FALSE.
   *
   * @var bool
   *
   * @see \Drupal\layout_builder\Access\LayoutBuilderAccessCheck
   */
  public $handles_permission_check = FALSE;

  /**
   * {@inheritdoc}
   */
  public function get() {
    return new SectionStorageDefinition($this->definition);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Plugin::$definition protected property The plugin definition read from the class annotation. 1
Plugin::getClass public function Gets the class of the annotated class. Overrides AnnotationInterface::getClass
Plugin::getId public function Gets the unique ID for this annotated class. Overrides AnnotationInterface::getId
Plugin::getProvider public function Gets the name of the provider of the annotated class. Overrides AnnotationInterface::getProvider 1
Plugin::parse protected function Parses an annotation into its definition.
Plugin::setClass public function Sets the class of the annotated class. Overrides AnnotationInterface::setClass
Plugin::setProvider public function Sets the name of the provider of the annotated class. Overrides AnnotationInterface::setProvider
Plugin::__construct public function Constructs a Plugin object. 2
SectionStorage::$context_definitions public property Any required context definitions, optional.
SectionStorage::$handles_permission_check public property Indicates that this section storage handles its own permission checking.
SectionStorage::$id public property The plugin ID.
SectionStorage::$weight public property The plugin weight, optional (defaults to 0).
SectionStorage::get public function Gets the value of an annotation. Overrides Plugin::get