LayoutDefinition
class LayoutDefinition extends PluginDefinition implements PluginDefinitionInterface, DerivablePluginDefinitionInterface, DependentPluginDefinitionInterface, ContextAwarePluginDefinitionInterface (View source)
Provides an implementation of a layout definition and its metadata.
Traits
Provides a trait for context-aware object-based plugin definitions.
Provides a trait for a plugin definition that has dependencies.
Properties
| protected string | $id | The plugin ID. |
from PluginDefinition |
| protected string | $class | A fully qualified class name. |
from PluginDefinition |
| protected string | $provider | The plugin provider. |
from PluginDefinition |
| protected ContextDefinitionInterface[] | $contextDefinitions | The context definitions for this plugin definition. |
from ContextAwarePluginDefinitionTrait |
| protected array | $config_dependencies | The dependencies of this plugin definition. |
from DependentPluginDefinitionTrait |
| protected string|null | $deriver | The name of the deriver of this layout definition, if any. |
|
| protected string | $label | The human-readable name. |
|
| protected string | $description | An optional description for advanced layouts. |
|
| protected string | $category | The human-readable category. |
|
| protected string|null | $template | The template file to render this layout (relative to the 'path' given). |
|
| protected string | $templatePath | The path to the template. |
|
| protected string|null | $theme_hook | The theme hook used to render this layout. |
|
| protected string | $path | Path (relative to the module or theme) to resources like icon or template. |
|
| protected string|null | $library | The asset library. |
|
| protected string | $icon | The path to the preview image. |
|
| protected string[][]|null | $icon_map | An array defining the regions of a layout. |
|
| protected array | $regions | An associative array of regions in this layout. |
|
| protected string | $default_region | The default region. |
|
| protected array | $additional | Any additional properties and values. |
Methods
Implements \Drupal\Component\Plugin\Definition\ContextAwarePluginDefinitionInterface::hasContextDefinition().
Implements \Drupal\Component\Plugin\Definition\ContextAwarePluginDefinitionInterface::getContextDefinitions().
Implements \Drupal\Component\Plugin\Definition\ContextAwarePluginDefinitionInterface::getContextDefinition().
Implements \Drupal\Component\Plugin\Definition\ContextAwarePluginDefinitionInterface::addContextDefinition().
Implements \Drupal\Component\Plugin\Definition\ContextAwarePluginDefinitionInterface::removeContextDefinition().
LayoutDefinition constructor.
Gets any arbitrary property.
Sets a value to an arbitrary property.
Gets the human-readable name of the layout definition.
Gets the description of the layout definition.
Sets the description of the layout definition.
Gets the human-readable category of the layout definition.
Sets the human-readable category of the layout definition.
Gets the template name.
Sets the template name.
Gets the template path.
Sets the template path.
Gets the theme hook.
Sets the theme hook.
Gets the base path for this layout definition.
Sets the base path for this layout definition.
Gets the asset library for this layout definition.
Sets the asset library for this layout definition.
Gets the icon path for this layout definition.
Sets the icon path for this layout definition.
Gets the icon map for this layout definition.
Sets the icon map for this layout definition.
Builds a render array for an icon representing the layout.
Wraps the icon builder.
Gets the regions for this layout definition.
Sets the regions for this layout definition.
Gets the machine-readable region names.
Gets the human-readable region labels.
Gets the default region.
Sets the default region.
Gets the name of the deriver of this plugin definition, if it exists.
Sets the deriver of this plugin definition.
Details
string
id()
Gets the unique identifier of the plugin.
PluginDefinitionInterface
setClass(string $class)
Sets the class.
string
getClass()
Gets the class.
string
getProvider()
Gets the plugin provider.
The provider is the name of the module that provides the plugin, or "core', or "component".
hasContextDefinition($name)
Implements \Drupal\Component\Plugin\Definition\ContextAwarePluginDefinitionInterface::hasContextDefinition().
getContextDefinitions()
Implements \Drupal\Component\Plugin\Definition\ContextAwarePluginDefinitionInterface::getContextDefinitions().
getContextDefinition($name)
Implements \Drupal\Component\Plugin\Definition\ContextAwarePluginDefinitionInterface::getContextDefinition().
addContextDefinition($name, ContextDefinitionInterface $definition)
Implements \Drupal\Component\Plugin\Definition\ContextAwarePluginDefinitionInterface::addContextDefinition().
removeContextDefinition($name)
Implements \Drupal\Component\Plugin\Definition\ContextAwarePluginDefinitionInterface::removeContextDefinition().
getConfigDependencies()
{@inheritdoc}
setConfigDependencies(array $config_dependencies)
{@inheritdoc}
__construct(array $definition)
LayoutDefinition constructor.
mixed
get(string $property)
Gets any arbitrary property.
$this
set(string $property, mixed $value)
Sets a value to an arbitrary property.
string|TranslatableMarkup
getLabel()
Gets the human-readable name of the layout definition.
$this
setLabel(string|TranslatableMarkup $label)
Sets the human-readable name of the layout definition.
string|TranslatableMarkup
getDescription()
Gets the description of the layout definition.
$this
setDescription(string|TranslatableMarkup $description)
Sets the description of the layout definition.
string|TranslatableMarkup
getCategory()
Gets the human-readable category of the layout definition.
$this
setCategory(string|TranslatableMarkup $category)
Sets the human-readable category of the layout definition.
string|null
getTemplate()
Gets the template name.
$this
setTemplate(string|null $template)
Sets the template name.
string
getTemplatePath()
Gets the template path.
$this
setTemplatePath(string $template_path)
Sets the template path.
string|null
getThemeHook()
Gets the theme hook.
$this
setThemeHook(string $theme_hook)
Sets the theme hook.
string
getPath()
Gets the base path for this layout definition.
$this
setPath(string $path)
Sets the base path for this layout definition.
string|null
getLibrary()
Gets the asset library for this layout definition.
$this
setLibrary(string|null $library)
Sets the asset library for this layout definition.
string|null
getIconPath()
Gets the icon path for this layout definition.
$this
setIconPath(string|null $icon)
Sets the icon path for this layout definition.
string[][]|null
getIconMap()
Gets the icon map for this layout definition.
This should not be used if an icon path is specified. See ::getIcon().
$this
setIconMap(string[][]|null $icon_map)
Sets the icon map for this layout definition.
array
getIcon(int $width = 125, int $height = 150, int $stroke_width = NULL, int $padding = NULL)
Builds a render array for an icon representing the layout.
protected IconBuilderInterface
getIconBuilder()
Wraps the icon builder.
array[]
getRegions()
Gets the regions for this layout definition.
$this
setRegions(array $regions)
Sets the regions for this layout definition.
string[]
getRegionNames()
Gets the machine-readable region names.
string[]
getRegionLabels()
Gets the human-readable region labels.
string
getDefaultRegion()
Gets the default region.
$this
setDefaultRegion(string $default_region)
Sets the default region.
string|null
getDeriver()
Gets the name of the deriver of this plugin definition, if it exists.
$this
setDeriver(string|null $deriver)
Sets the deriver of this plugin definition.