SectionComponent
class SectionComponent (View source)
Provides a value object for a section component.
A component represents the smallest part of a layout (for example, a block). Components wrap a renderable plugin, currently using \Drupal\Core\Block\BlockPluginInterface, and contain the layout region within the section layout where the component will be rendered.
Properties
| protected string | $uuid | The UUID of the component. |
|
| protected string | $region | The region the component is placed in. |
|
| protected array | $configuration | An array of plugin configuration. |
|
| protected int | $weight | The weight of the component. |
|
| protected array | $additional | Any additional properties and values. |
Methods
Constructs a new SectionComponent.
Returns the renderable array for this component.
Gets any arbitrary property for the component.
Sets a value to an arbitrary property for the component.
Gets the region for the component.
Sets the region for the component.
Gets the weight of the component.
Sets the weight of the component.
Gets the component plugin configuration.
Sets the plugin configuration.
Gets the plugin ID.
Gets the UUID for this component.
Gets the plugin for this component.
Wraps the component plugin manager.
Wraps the context handler.
Wraps the event dispatcher.
Returns an array representation of the section component.
Creates an object from an array representation of the section component.
Details
__construct(string $uuid, string $region, array $configuration = [], array $additional = [])
Constructs a new SectionComponent.
array
toRenderArray(array $contexts = [], bool $in_preview = FALSE)
Returns the renderable array for this component.
mixed
get(string $property)
Gets any arbitrary property for the component.
$this
set(string $property, mixed $value)
Sets a value to an arbitrary property for the component.
string
getRegion()
Gets the region for the component.
$this
setRegion(string $region)
Sets the region for the component.
int
getWeight()
Gets the weight of the component.
$this
setWeight(int $weight)
Sets the weight of the component.
protected array
getConfiguration()
Gets the component plugin configuration.
$this
setConfiguration(array $configuration)
Sets the plugin configuration.
string
getPluginId()
Gets the plugin ID.
string
getUuid()
Gets the UUID for this component.
PluginInspectionInterface
getPlugin(array $contexts = [])
Gets the plugin for this component.
protected BlockManagerInterface
pluginManager()
Wraps the component plugin manager.
protected ContextHandlerInterface
contextHandler()
Wraps the context handler.
protected EventDispatcherInterface
eventDispatcher()
Wraps the event dispatcher.
array
toArray()
Returns an array representation of the section component.
Only use this method if you are implementing custom storage for sections.
static SectionComponent
fromArray(array $component)
Creates an object from an array representation of the section component.
Only use this method if you are implementing custom storage for sections.