3 namespace Drupal\layout_builder\SectionStorage;
5 use Drupal\Component\Plugin\Definition\PluginDefinition;
8 * Provides section storage type plugin definition.
11 * Layout Builder is currently experimental and should only be leveraged by
12 * experimental modules and development releases of contributed modules.
13 * See https://www.drupal.org/core/experimental for more information.
15 class SectionStorageDefinition extends PluginDefinition {
18 * Any additional properties and values.
22 protected $additional = [];
25 * LayoutDefinition constructor.
27 * @param array $definition
28 * An array of values from the annotation.
30 public function __construct(array $definition = []) {
31 foreach ($definition as $property => $value) {
32 $this->set($property, $value);
37 * Gets any arbitrary property.
39 * @param string $property
40 * The property to retrieve.
43 * The value for that property, or NULL if the property does not exist.
45 public function get($property) {
46 if (property_exists($this, $property)) {
47 $value = isset($this->{$property}) ? $this->{$property} : NULL;
50 $value = isset($this->additional[$property]) ? $this->additional[$property] : NULL;
56 * Sets a value to an arbitrary property.
58 * @param string $property
59 * The property to use for the value.
65 public function set($property, $value) {
66 if (property_exists($this, $property)) {
67 $this->{$property} = $value;
70 $this->additional[$property] = $value;