class SectionStorageDefinition
Provides section storage type plugin definition.
Hierarchy
- class \Drupal\Component\Plugin\Definition\PluginDefinition implements \Drupal\Component\Plugin\Definition\PluginDefinitionInterface
- class \Drupal\layout_builder\SectionStorage\SectionStorageDefinition implements \Drupal\Component\Plugin\Definition\ContextAwarePluginDefinitionInterface uses \Drupal\Component\Plugin\Definition\ContextAwarePluginDefinitionTrait extends \Drupal\Component\Plugin\Definition\PluginDefinition
 
 
Expanded class hierarchy of SectionStorageDefinition
8 files declare their use of SectionStorageDefinition
- DefaultsSectionStorageTest.php in core/
modules/ layout_builder/ tests/ src/ Unit/ DefaultsSectionStorageTest.php  - DefaultsSectionStorageTest.php in core/
modules/ layout_builder/ tests/ src/ Kernel/ DefaultsSectionStorageTest.php  - LayoutBuilderRoutesTest.php in core/
modules/ layout_builder/ tests/ src/ Unit/ LayoutBuilderRoutesTest.php  - LayoutBuilderRoutesTrait.php in core/
modules/ layout_builder/ src/ Routing/ LayoutBuilderRoutesTrait.php  - OverridesSectionStorageTest.php in core/
modules/ layout_builder/ tests/ src/ Unit/ OverridesSectionStorageTest.php  
File
- 
              core/
modules/ layout_builder/ src/ SectionStorage/ SectionStorageDefinition.php, line 12  
Namespace
Drupal\layout_builder\SectionStorageView source
class SectionStorageDefinition extends PluginDefinition implements ContextAwarePluginDefinitionInterface {
  use ContextAwarePluginDefinitionTrait;
  
  /**
   * The plugin weight.
   *
   * @var int
   */
  protected $weight = 0;
  
  /**
   * Any additional properties and values.
   *
   * @var array
   */
  protected $additional = [];
  
  /**
   * LayoutDefinition constructor.
   *
   * @param array $definition
   *   An array of values from the annotation.
   */
  public function __construct(array $definition = []) {
    // If there are context definitions in the plugin definition, they should
    // be added to this object using ::addContextDefinition() so that they can
    // be manipulated using other ContextAwarePluginDefinitionInterface methods.
    if (isset($definition['context_definitions'])) {
      foreach ($definition['context_definitions'] as $name => $context_definition) {
        $this->addContextDefinition($name, $context_definition);
      }
      unset($definition['context_definitions']);
    }
    foreach ($definition as $property => $value) {
      $this->set($property, $value);
    }
  }
  
  /**
   * Gets any arbitrary property.
   *
   * @param string $property
   *   The property to retrieve.
   *
   * @return mixed
   *   The value for that property, or NULL if the property does not exist.
   */
  public function get($property) {
    if (property_exists($this, $property)) {
      $value = isset($this->{$property}) ? $this->{$property} : NULL;
    }
    else {
      $value = isset($this->additional[$property]) ? $this->additional[$property] : NULL;
    }
    return $value;
  }
  
  /**
   * Sets a value to an arbitrary property.
   *
   * @param string $property
   *   The property to use for the value.
   * @param mixed $value
   *   The value to set.
   *
   * @return $this
   */
  public function set($property, $value) {
    if (property_exists($this, $property)) {
      $this->{$property} = $value;
    }
    else {
      $this->additional[$property] = $value;
    }
    return $this;
  }
  
  /**
   * Returns the plugin weight.
   *
   * @return int
   *   The plugin weight.
   */
  public function getWeight() {
    return $this->weight;
  }
}
Members
| Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides | 
|---|---|---|---|---|---|
| ContextAwarePluginDefinitionTrait::$contextDefinitions | protected | property | The context definitions for this plugin definition. | ||
| ContextAwarePluginDefinitionTrait::addContextDefinition | public | function | Implements \Drupal\Component\Plugin\Definition\ContextAwarePluginDefinitionInterface::addContextDefinition(). | ||
| ContextAwarePluginDefinitionTrait::getContextDefinition | public | function | Implements \Drupal\Component\Plugin\Definition\ContextAwarePluginDefinitionInterface::getContextDefinition(). | ||
| ContextAwarePluginDefinitionTrait::getContextDefinitions | public | function | Implements \Drupal\Component\Plugin\Definition\ContextAwarePluginDefinitionInterface::getContextDefinitions(). | ||
| ContextAwarePluginDefinitionTrait::hasContextDefinition | public | function | Implements \Drupal\Component\Plugin\Definition\ContextAwarePluginDefinitionInterface::hasContextDefinition(). | ||
| ContextAwarePluginDefinitionTrait::removeContextDefinition | public | function | Implements \Drupal\Component\Plugin\Definition\ContextAwarePluginDefinitionInterface::removeContextDefinition(). | ||
| PluginDefinition::$class | protected | property | A fully qualified class name. | ||
| PluginDefinition::$id | protected | property | The plugin ID. | 1 | |
| PluginDefinition::$provider | protected | property | The plugin provider. | ||
| PluginDefinition::getClass | public | function | Gets the class. | Overrides PluginDefinitionInterface::getClass | |
| PluginDefinition::getProvider | public | function | Gets the plugin provider. | Overrides PluginDefinitionInterface::getProvider | |
| PluginDefinition::id | public | function | Gets the unique identifier of the plugin. | Overrides PluginDefinitionInterface::id | 1 | 
| PluginDefinition::setClass | public | function | Sets the class. | Overrides PluginDefinitionInterface::setClass | 1 | 
| SectionStorageDefinition::$additional | protected | property | Any additional properties and values. | ||
| SectionStorageDefinition::$weight | protected | property | The plugin weight. | ||
| SectionStorageDefinition::get | public | function | Gets any arbitrary property. | ||
| SectionStorageDefinition::getWeight | public | function | Returns the plugin weight. | ||
| SectionStorageDefinition::set | public | function | Sets a value to an arbitrary property. | ||
| SectionStorageDefinition::__construct | public | function | LayoutDefinition constructor. | 
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.