function Layout::__construct
Same name in other branches
- 11.x core/lib/Drupal/Core/Layout/Attribute/Layout.php \Drupal\Core\Layout\Attribute\Layout::__construct()
Constructs a Layout attribute.
Parameters
string $id: The plugin ID.
\Drupal\Core\StringTranslation\TranslatableMarkup|null $label: (optional) The human-readable name. @todo Deprecate optional label in https://www.drupal.org/project/drupal/issues/3392572.
\Drupal\Core\StringTranslation\TranslatableMarkup|null $category: (optional) The human-readable category. @todo Deprecate optional category in https://www.drupal.org/project/drupal/issues/3392572.
\Drupal\Core\StringTranslation\TranslatableMarkup|null $description: (optional) The description for advanced layouts.
string|null $template: (optional) The template file to render the layout.
string $theme_hook: (optional) The template hook to render the layout.
string|null $path: (optional) Path (relative to the module or theme) to resources like icon or template.
string|null $library: (optional) The asset library.
string|null $icon: (optional) The path to the preview image (relative to the 'path' given).
string[][]|null $icon_map: (optional) The icon map.
array $regions: (optional) An associative array of regions in this layout.
string|null $default_region: (optional) The default region.
class-string $class: (optional) The layout plugin class.
\Drupal\Core\Plugin\Context\ContextDefinitionInterface[] $context_definitions: (optional) The context definition.
array $config_dependencies: (optional) The config dependencies.
class-string|null $deriver: (optional) The deriver class.
mixed $additional: (optional) Additional properties passed in that can be used by a deriver.
Overrides Plugin::__construct
File
-
core/
lib/ Drupal/ Core/ Layout/ Attribute/ Layout.php, line 75
Class
- Layout
- Defines a Layout attribute object.
Namespace
Drupal\Core\Layout\AttributeCode
public function __construct(string $id, ?TranslatableMarkup $label = NULL, ?TranslatableMarkup $category = NULL, ?TranslatableMarkup $description = NULL, ?string $template = NULL, string $theme_hook = 'layout', ?string $path = NULL, ?string $library = NULL, ?string $icon = NULL, ?array $icon_map = NULL, array $regions = [], ?string $default_region = NULL, string $class = LayoutDefault::class, array $context_definitions = [], array $config_dependencies = [], ?string $deriver = NULL, ...$additional) {
// Layout definitions support arbitrary properties being passed in, which
// are stored in the 'additional' property in LayoutDefinition. The variadic
// 'additional' parameter here saves arbitrary parameters passed into the
// 'additional' property in this attribute class. The 'additional' property
// gets passed to the LayoutDefinition constructor in ::get().
// @see \Drupal\Core\Layout\LayoutDefinition::$additional
// @see \Drupal\Core\Layout\LayoutDefinition::get()
$this->additional = $additional;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.