DefaultsSectionStorageInterface
interface DefaultsSectionStorageInterface implements SectionStorageInterface, ThirdPartySettingsInterface, LayoutBuilderEnabledInterface (View source)
Defines an interface for an object that stores layout sections for defaults.
Methods
Gets a domain object for the layout section.
Removes all of the sections.
Gets the definition of the plugin implementation.
Gets the context definitions of the plugin.
Gets a specific context definition of the plugin.
Gets the value for a defined context.
Sets the value for a defined context.
Validates the set values for the defined contexts.
Gets a mapping of the expected assignment names to their context names.
Sets a mapping of the expected assignment names to their context names.
Checks data value access.
Provides the routes needed for Layout Builder UI.
Gets the URL used when redirecting away from the Layout Builder UI.
Gets the URL used to display the Layout Builder UI.
Derives the available plugin contexts from route values.
Gets contexts for use during preview.
Determines if this section storage is applicable for the current contexts.
Sets the value of a third-party setting.
Gets the value of a third-party setting.
Gets all third-party settings of a given module.
Unsets a third-party setting.
Gets the list of third parties that store information.
Determines if Layout Builder is enabled.
Determines if the defaults allow custom overrides.
Sets the defaults to allow or disallow overrides.
Details
Section[]
getSections()
Gets the layout sections.
Section
getSection(int $delta)
Gets a domain object for the layout section.
$this
appendSection(Section $section)
Appends a new section to the end of the list.
$this
insertSection(int $delta, Section $section)
Inserts a new section at a given delta.
If a section exists at the given index, the section at that position and others after it are shifted backward.
$this
removeSection(int $delta)
Removes the section at the given delta.
As sections are stored sequentially and numerically this will re-key every subsequent section, shifting them forward.
$this
removeAllSections(bool $set_blank = FALSE)
Removes all of the sections.
string
getPluginId()
Gets the plugin_id of the plugin instance.
array
getPluginDefinition()
Gets the definition of the plugin implementation.
ContextDefinitionInterface[]
getContextDefinitions()
Gets the context definitions of the plugin.
ContextDefinitionInterface
getContextDefinition(string $name)
Gets a specific context definition of the plugin.
array
getContexts()
Gets the defined contexts.
ContextInterface
getContext(string $name)
Gets a defined context.
array
getContextValues()
Gets the values for all defined contexts.
mixed
getContextValue(string $name)
Gets the value for a defined context.
setContext(string $name, ContextInterface $context)
Set a context on this plugin.
$this
setContextValue(string $name, mixed $value)
Sets the value for a defined context.
ConstraintViolationListInterface
validateContexts()
Validates the set values for the defined contexts.
array
getContextMapping()
Gets a mapping of the expected assignment names to their context names.
$this
setContextMapping(array $context_mapping)
Sets a mapping of the expected assignment names to their context names.
bool|AccessResultInterface
access(string $operation, AccountInterface $account = NULL, bool $return_as_object = FALSE)
Checks data value access.
string
getStorageId()
Returns an identifier for this storage.
string
getStorageType()
Returns the type of this storage.
Used in conjunction with the storage ID.
buildRoutes(RouteCollection $collection)
Provides the routes needed for Layout Builder UI.
Allows the plugin to add or alter routes during the route building process. \Drupal\layout_builder\Routing\LayoutBuilderRoutesTrait is provided for the typical use case of building a standard Layout Builder UI.
Url
getRedirectUrl()
Gets the URL used when redirecting away from the Layout Builder UI.
Url
getLayoutBuilderUrl(string $rel = 'view')
Gets the URL used to display the Layout Builder UI.
ContextInterface[]
deriveContextsFromRoute(mixed $value, mixed $definition, string $name, array $defaults)
Derives the available plugin contexts from route values.
This should only be called during section storage instantiation, specifically for use by the routing system. For all non-routing usages, use \Drupal\Component\Plugin\ContextAwarePluginInterface::getContextValue().
ContextInterface[]
getContextsDuringPreview()
Gets contexts for use during preview.
When not in preview, ::getContexts() will be used.
string
label()
Gets the label for the object using the sections.
int
save()
Saves the sections.
bool
isApplicable(RefinableCacheableDependencyInterface $cacheability)
| internal | This method is intended to be called by \Drupal\layout_builder\SectionStorage\SectionStorageManagerInterface::findByContext(). |
Determines if this section storage is applicable for the current contexts.
$this
setThirdPartySetting(string $module, string $key, mixed $value)
Sets the value of a third-party setting.
mixed
getThirdPartySetting(string $module, string $key, mixed $default = NULL)
Gets the value of a third-party setting.
array
getThirdPartySettings(string $module)
Gets all third-party settings of a given module.
mixed
unsetThirdPartySetting(string $module, string $key)
Unsets a third-party setting.
array
getThirdPartyProviders()
Gets the list of third parties that store information.
bool
isLayoutBuilderEnabled()
Determines if Layout Builder is enabled.
$this
enableLayoutBuilder()
Enables the Layout Builder.
$this
disableLayoutBuilder()
Disables the Layout Builder.
bool
isOverridable()
Determines if the defaults allow custom overrides.
$this
setOverridable(bool $overridable = TRUE)
Sets the defaults to allow or disallow overrides.