function LayoutDefinition::__construct

Same name in other branches
  1. 9 core/lib/Drupal/Core/Layout/LayoutDefinition.php \Drupal\Core\Layout\LayoutDefinition::__construct()
  2. 8.9.x core/lib/Drupal/Core/Layout/LayoutDefinition.php \Drupal\Core\Layout\LayoutDefinition::__construct()
  3. 11.x core/lib/Drupal/Core/Layout/LayoutDefinition.php \Drupal\Core\Layout\LayoutDefinition::__construct()

LayoutDefinition constructor.

Parameters

array $definition: An array of values from the attribute.

File

core/lib/Drupal/Core/Layout/LayoutDefinition.php, line 137

Class

LayoutDefinition
Provides an implementation of a layout definition and its metadata.

Namespace

Drupal\Core\Layout

Code

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);
    }
}

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