Section
class Section implements ThirdPartySettingsInterface (View source)
Provides a domain object for layout sections.
A section consists of three parts:
- The layout plugin ID for the layout applied to the section (for example, 'layout_onecol').
- An array of settings for the layout plugin.
- An array of components that can be rendered in the section.
Properties
| protected string | $layoutId | The layout plugin ID. |
|
| protected array | $layoutSettings | The layout plugin settings. |
|
| protected SectionComponent[] | $components | An array of components, keyed by UUID. |
|
| protected array[] | $thirdPartySettings | Third party settings. |
Methods
Constructs a new Section.
Returns the renderable array for this section.
Gets the layout plugin for this section.
Gets the layout plugin ID for this section.
Gets the layout plugin settings for this section.
Sets the layout plugin settings for this section.
Gets the default region.
Returns the components of the section.
Gets the component for a given UUID.
Removes a given component from a region.
Returns the next highest weight of the component in a region.
Gets the components for a specific region.
Inserts a component after a specified existing component.
Inserts a component at a specified delta.
Wraps the layout plugin manager.
Returns an array representation of the section.
Creates an object from an array representation of the section.
Magic method: Implements a deep clone.
Gets the value of a third-party setting.
Gets all third-party settings of a given module.
Sets the value of a third-party setting.
Unsets a third-party setting.
Gets the list of third parties that store information.
Details
__construct(string $layout_id, array $layout_settings = [], array $components = [], array $third_party_settings = [])
Constructs a new Section.
array
toRenderArray(array $contexts = [], bool $in_preview = FALSE)
Returns the renderable array for this section.
LayoutInterface
getLayout()
Gets the layout plugin for this section.
string
getLayoutId()
| internal | This method should only be used by code responsible for storing the data. |
Gets the layout plugin ID for this section.
array
getLayoutSettings()
| internal | This method should only be used by code responsible for storing the data. |
Gets the layout plugin settings for this section.
$this
setLayoutSettings(array $layout_settings)
Sets the layout plugin settings for this section.
string
getDefaultRegion()
Gets the default region.
SectionComponent[]
getComponents()
Returns the components of the section.
SectionComponent
getComponent(string $uuid)
Gets the component for a given UUID.
protected $this
setComponent(SectionComponent $component)
Helper method to set a component.
$this
removeComponent(string $uuid)
Removes a given component from a region.
$this
appendComponent(SectionComponent $component)
Appends a component to the end of a region.
protected int
getNextHighestWeight(string $region)
Returns the next highest weight of the component in a region.
SectionComponent[]
getComponentsByRegion(string $region)
Gets the components for a specific region.
$this
insertAfterComponent(string $preceding_uuid, SectionComponent $component)
Inserts a component after a specified existing component.
$this
insertComponent(int $delta, SectionComponent $new_component)
Inserts a component at a specified delta.
protected LayoutPluginManagerInterface
layoutPluginManager()
Wraps the layout plugin manager.
array
toArray()
Returns an array representation of the section.
Only use this method if you are implementing custom storage for sections.
static Section
fromArray(array $section)
Creates an object from an array representation of the section.
Only use this method if you are implementing custom storage for sections.
__clone()
Magic method: Implements a deep clone.
mixed
getThirdPartySetting($provider, string $key, mixed $default = NULL)
Gets the value of a third-party setting.
array
getThirdPartySettings($provider)
Gets all third-party settings of a given module.
$this
setThirdPartySetting($provider, string $key, mixed $value)
Sets the value of a third-party setting.
mixed
unsetThirdPartySetting($provider, string $key)
Unsets a third-party setting.
array
getThirdPartyProviders()
Gets the list of third parties that store information.