class Layout
Same name in other branches
- 9 core/lib/Drupal/Core/Layout/Annotation/Layout.php \Drupal\Core\Layout\Annotation\Layout
- 10 core/lib/Drupal/Core/Layout/Annotation/Layout.php \Drupal\Core\Layout\Annotation\Layout
- 11.x core/lib/Drupal/Core/Layout/Annotation/Layout.php \Drupal\Core\Layout\Annotation\Layout
- 11.x core/lib/Drupal/Core/Layout/Attribute/Layout.php \Drupal\Core\Layout\Attribute\Layout
- 10 core/lib/Drupal/Core/Layout/Attribute/Layout.php \Drupal\Core\Layout\Attribute\Layout
Defines a Layout annotation object.
Layouts are used to define a list of regions and then output render arrays in each of the regions, usually using a template.
Plugin namespace: Plugin\Layout
Hierarchy
- class \Drupal\Component\Annotation\Plugin implements \Drupal\Component\Annotation\AnnotationInterface
- class \Drupal\Core\Layout\Annotation\Layout extends \Drupal\Component\Annotation\Plugin
Expanded class hierarchy of Layout
See also
\Drupal\Core\Layout\LayoutInterface
\Drupal\Core\Layout\LayoutDefault
\Drupal\Core\Layout\LayoutPluginManager
Related topics
1 file declares its use of Layout
- LayoutPluginManager.php in core/
lib/ Drupal/ Core/ Layout/ LayoutPluginManager.php
32 string references to 'Layout'
- field.field.node.recipe.layout_builder__layout.yml in core/
profiles/ demo_umami/ config/ install/ field.field.node.recipe.layout_builder__layout.yml - core/profiles/demo_umami/config/install/field.field.node.recipe.layout_builder__layout.yml
- InspectionTest::testInspection in core/
tests/ Drupal/ KernelTests/ Core/ Plugin/ InspectionTest.php - Ensure the test plugins correctly implement getPluginId() and getPluginDefinition().
- LayoutBuilderContentModerationIntegrationTest::testLayoutModeration in core/
modules/ content_moderation/ tests/ src/ Functional/ LayoutBuilderContentModerationIntegrationTest.php - Tests that Layout changes are respected by Content Moderation.
- LayoutBuilderEntityViewDisplay::addSectionField in core/
modules/ layout_builder/ src/ Entity/ LayoutBuilderEntityViewDisplay.php - Adds a layout section field to a given bundle.
- LayoutBuilderEntityViewDisplayForm::copyFormValuesToEntity in core/
modules/ layout_builder/ src/ Form/ LayoutBuilderEntityViewDisplayForm.php - Copies top-level form values to entity properties
6 classes are annotated with Layout
- BlankLayout in core/
modules/ layout_builder/ src/ Plugin/ Layout/ BlankLayout.php - Provides a layout plugin that produces no output.
- LayoutBuilderTestPlugin in core/
modules/ layout_builder/ tests/ modules/ layout_builder_test/ src/ Plugin/ Layout/ LayoutBuilderTestPlugin.php - Plugin annotation @Layout( id = "layout_builder_test_plugin", label = @Translation("Layout Builder Test Plugin"), regions = { "main" = { "label" = @Translation("Main Region") } }, )
- LayoutTestDependenciesPlugin in core/
modules/ system/ tests/ modules/ layout_test/ src/ Plugin/ Layout/ LayoutTestDependenciesPlugin.php - Provides a plugin that contains config dependencies.
- LayoutTestPlugin in core/
modules/ system/ tests/ modules/ layout_test/ src/ Plugin/ Layout/ LayoutTestPlugin.php - The plugin that handles the default layout template.
- TestLayoutContentFooter in core/
modules/ field_layout/ tests/ modules/ field_layout_test/ src/ Plugin/ Layout/ TestLayoutContentFooter.php - Provides an annotated layout plugin for field_layout tests.
File
-
core/
lib/ Drupal/ Core/ Layout/ Annotation/ Layout.php, line 24
Namespace
Drupal\Core\Layout\AnnotationView source
class Layout extends Plugin {
/**
* The plugin ID.
*
* @var string
*/
public $id;
/**
* The human-readable name.
*
* @var string
*
* @ingroup plugin_translatable
*/
public $label;
/**
* An optional description for advanced layouts.
*
* Sometimes layouts are so complex that the name is insufficient to describe
* a layout such that a visually impaired administrator could layout a page
* for a non-visually impaired audience. If specified, it will provide a
* description that is used for accessibility purposes.
*
* @var string
*
* @ingroup plugin_translatable
*/
public $description;
/**
* The human-readable category.
*
* @var string
*
* @see \Drupal\Component\Plugin\CategorizingPluginManagerInterface
*
* @ingroup plugin_translatable
*/
public $category;
/**
* The template file to render this layout (relative to the 'path' given).
*
* If specified, then the layout_discovery module will register the template
* with hook_theme() and the module or theme registering this layout does not
* need to do it.
*
* @var string optional
*
* @see hook_theme()
*/
public $template;
/**
* The theme hook used to render this layout.
*
* If specified, it's assumed that the module or theme registering this layout
* will also register the theme hook with hook_theme() itself. This is
* mutually exclusive with 'template' - you can't specify both.
*
* @var string optional
*
* @see hook_theme()
*/
public $theme_hook = 'layout';
/**
* Path (relative to the module or theme) to resources like icon or template.
*
* @var string optional
*/
public $path;
/**
* The asset library.
*
* @var string optional
*/
public $library;
/**
* The path to the preview image (relative to the 'path' given).
*
* @var string optional
*/
public $icon;
/**
* The icon map.
*
* @var string[][] optional
*
* @see \Drupal\Core\Layout\Icon\IconBuilderInterface::build()
*/
public $icon_map;
/**
* An associative array of regions in this layout.
*
* The key of the array is the machine name of the region, and the value is
* an associative array with the following keys:
* - label: (string) The human-readable name of the region.
*
* Any remaining keys may have special meaning for the given layout plugin,
* but are undefined here.
*
* @var array
*/
public $regions = [];
/**
* The default region.
*
* @var string
*/
public $default_region;
/**
* The layout plugin class.
*
* This default value is used for plugins defined in layouts.yml that do not
* specify a class themselves.
*
* @var string
*/
public $class = LayoutDefault::class;
/**
* {@inheritdoc}
*/
public function get() {
return new LayoutDefinition($this->definition);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
Layout::$category | public | property | The human-readable category. | ||
Layout::$class | public | property | The layout plugin class. | ||
Layout::$default_region | public | property | The default region. | ||
Layout::$description | public | property | An optional description for advanced layouts. | ||
Layout::$icon | public | property | The path to the preview image (relative to the 'path' given). | ||
Layout::$icon_map | public | property | The icon map. | ||
Layout::$id | public | property | The plugin ID. | ||
Layout::$label | public | property | The human-readable name. | ||
Layout::$library | public | property | The asset library. | ||
Layout::$path | public | property | Path (relative to the module or theme) to resources like icon or template. | ||
Layout::$regions | public | property | An associative array of regions in this layout. | ||
Layout::$template | public | property | The template file to render this layout (relative to the 'path' given). | ||
Layout::$theme_hook | public | property | The theme hook used to render this layout. | ||
Layout::get | public | function | Gets the value of an annotation. | Overrides Plugin::get | |
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 |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.