interface SectionStorageInterface in Drupal 8
Same name and namespace in other branches
- 9 core/modules/layout_builder/src/SectionStorageInterface.php \Drupal\layout_builder\SectionStorageInterface
Defines an interface for Section Storage type plugins.
Hierarchy
- interface \Drupal\layout_builder\SectionListInterface extends \Drupal\layout_builder\Countable; interface \Drupal\Component\Plugin\PluginInspectionInterface; interface \Drupal\Core\Plugin\ContextAwarePluginInterface; interface \Drupal\Core\Access\AccessibleInterface
- interface \Drupal\layout_builder\SectionStorageInterface
Expanded class hierarchy of SectionStorageInterface
All classes that implement SectionStorageInterface
32 files declare their use of SectionStorageInterface
- AddBlockForm.php in core/
modules/ layout_builder/ src/ Form/ AddBlockForm.php - AddSectionController.php in core/
modules/ layout_builder/ src/ Controller/ AddSectionController.php - ChooseBlockController.php in core/
modules/ layout_builder/ src/ Controller/ ChooseBlockController.php - ChooseSectionController.php in core/
modules/ layout_builder/ src/ Controller/ ChooseSectionController.php - ConfigureBlockFormBase.php in core/
modules/ layout_builder/ src/ Form/ ConfigureBlockFormBase.php
File
- core/
modules/ layout_builder/ src/ SectionStorageInterface.php, line 15
Namespace
Drupal\layout_builderView source
interface SectionStorageInterface extends SectionListInterface, PluginInspectionInterface, ContextAwarePluginInterface, AccessibleInterface {
/**
* Returns an identifier for this storage.
*
* @return string
* The unique identifier for this storage.
*/
public function getStorageId();
/**
* Returns the type of this storage.
*
* Used in conjunction with the storage ID.
*
* @return string
* The type of storage.
*/
public function getStorageType();
/**
* Derives the section list from the storage ID.
*
* @param string $id
* The storage ID, see ::getStorageId().
*
* @return \Drupal\layout_builder\SectionListInterface
* The section list.
*
* @throws \InvalidArgumentException
* Thrown if the ID is invalid.
*
* @internal
* This should only be called during section storage instantiation.
*
* @deprecated in drupal:8.7.0 and is removed from drupal:9.0.0. The
* section list should be derived from context. See
* https://www.drupal.org/node/3016262.
*/
public function getSectionListFromId($id);
/**
* 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.
*
* @param \Symfony\Component\Routing\RouteCollection $collection
* The route collection.
*
* @see \Drupal\Core\Routing\RoutingEvents::ALTER
*/
public function buildRoutes(RouteCollection $collection);
/**
* Gets the URL used when redirecting away from the Layout Builder UI.
*
* @return \Drupal\Core\Url
* The URL object.
*/
public function getRedirectUrl();
/**
* Gets the URL used to display the Layout Builder UI.
*
* @param string $rel
* (optional) The link relationship type, for example: 'view' or 'disable'.
* Defaults to 'view'.
*
* @return \Drupal\Core\Url
* The URL object.
*/
public function getLayoutBuilderUrl($rel = 'view');
/**
* Configures the plugin based on route values.
*
* @param mixed $value
* The raw value.
* @param mixed $definition
* The parameter definition provided in the route options.
* @param string $name
* The name of the parameter.
* @param array $defaults
* The route defaults array.
*
* @return string|null
* The section storage ID if it could be extracted, NULL otherwise.
*
* @internal
* This should only be called during section storage instantiation.
*
* @deprecated in drupal:8.7.0 and is removed from drupal:9.0.0.
* \Drupal\layout_builder\SectionStorageInterface::deriveContextsFromRoute()
* should be used instead. See https://www.drupal.org/node/3016262.
*/
public function extractIdFromRoute($value, $definition, $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().
*
* @param mixed $value
* The raw value.
* @param mixed $definition
* The parameter definition provided in the route options.
* @param string $name
* The name of the parameter.
* @param array $defaults
* The route defaults array.
*
* @return \Drupal\Core\Plugin\Context\ContextInterface[]
* The available plugin contexts.
*
* @see \Drupal\Core\ParamConverter\ParamConverterInterface::convert()
*/
public function deriveContextsFromRoute($value, $definition, $name, array $defaults);
/**
* Gets contexts for use during preview.
*
* When not in preview, ::getContexts() will be used.
*
* @return \Drupal\Core\Plugin\Context\ContextInterface[]
* The plugin contexts suitable for previewing.
*/
public function getContextsDuringPreview();
/**
* Gets the label for the object using the sections.
*
* @return string
* The label, or NULL if there is no label defined.
*/
public function label();
/**
* Saves the sections.
*
* @return int
* SAVED_NEW or SAVED_UPDATED is returned depending on the operation
* performed.
*/
public function save();
/**
* Determines if this section storage is applicable for the current contexts.
*
* @param \Drupal\Core\Cache\RefinableCacheableDependencyInterface $cacheability
* Refinable cacheability object, typically provided by the section storage
* manager. When implementing this method, populate $cacheability with any
* information that affects whether this storage is applicable.
*
* @return bool
* TRUE if this section storage is applicable, FALSE otherwise.
*
* @internal
* This method is intended to be called by
* \Drupal\layout_builder\SectionStorage\SectionStorageManagerInterface::findByContext().
*
* @see \Drupal\Core\Cache\RefinableCacheableDependencyInterface
*/
public function isApplicable(RefinableCacheableDependencyInterface $cacheability);
/**
* Overrides \Drupal\Component\Plugin\PluginInspectionInterface::getPluginDefinition().
*
* @return \Drupal\layout_builder\SectionStorage\SectionStorageDefinition
* The section storage definition.
*/
public function getPluginDefinition();
/**
* Overrides \Drupal\Core\Access\AccessibleInterface::access().
*
* @ingroup layout_builder_access
*/
public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE);
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContextAwarePluginInterface:: |
public | function | Gets a defined context. | 1 |
ContextAwarePluginInterface:: |
public | function |
Gets a specific context definition of the plugin. Overrides ContextAwarePluginInterface:: |
|
ContextAwarePluginInterface:: |
public | function |
Gets the context definitions of the plugin. Overrides ContextAwarePluginInterface:: |
|
ContextAwarePluginInterface:: |
public | function | Gets a mapping of the expected assignment names to their context names. | 1 |
ContextAwarePluginInterface:: |
public | function | Gets the defined contexts. | 1 |
ContextAwarePluginInterface:: |
public | function | Gets the value for a defined context. | 1 |
ContextAwarePluginInterface:: |
public | function | Gets the values for all defined contexts. | 1 |
ContextAwarePluginInterface:: |
public | function | Set a context on this plugin. | 1 |
ContextAwarePluginInterface:: |
public | function | Sets a mapping of the expected assignment names to their context names. | 1 |
ContextAwarePluginInterface:: |
public | function | Sets the value for a defined context. | 1 |
ContextAwarePluginInterface:: |
public | function | Validates the set values for the defined contexts. | 1 |
PluginInspectionInterface:: |
public | function | Gets the plugin_id of the plugin instance. | 2 |
SectionListInterface:: |
public | function | Appends a new section to the end of the list. | 1 |
SectionListInterface:: |
public | function | Gets a domain object for the layout section. | 1 |
SectionListInterface:: |
public | function | Gets the layout sections. | 5 |
SectionListInterface:: |
public | function | Inserts a new section at a given delta. | 1 |
SectionListInterface:: |
public | function | Removes all of the sections. | 1 |
SectionListInterface:: |
public | function | Removes the section at the given delta. | 1 |
SectionStorageInterface:: |
public | function |
Overrides \Drupal\Core\Access\AccessibleInterface::access(). Overrides AccessibleInterface:: |
4 |
SectionStorageInterface:: |
public | function | Provides the routes needed for Layout Builder UI. | 4 |
SectionStorageInterface:: |
public | function | Derives the available plugin contexts from route values. | 4 |
SectionStorageInterface:: |
public | function | Configures the plugin based on route values. | 4 |
SectionStorageInterface:: |
public | function | Gets contexts for use during preview. | 2 |
SectionStorageInterface:: |
public | function | Gets the URL used to display the Layout Builder UI. | 4 |
SectionStorageInterface:: |
public | function |
Overrides \Drupal\Component\Plugin\PluginInspectionInterface::getPluginDefinition(). Overrides PluginInspectionInterface:: |
|
SectionStorageInterface:: |
public | function | Gets the URL used when redirecting away from the Layout Builder UI. | 4 |
SectionStorageInterface:: |
public | function | Derives the section list from the storage ID. | 4 |
SectionStorageInterface:: |
public | function | Returns an identifier for this storage. | 4 |
SectionStorageInterface:: |
public | function | Returns the type of this storage. | 2 |
SectionStorageInterface:: |
public | function | Determines if this section storage is applicable for the current contexts. | 4 |
SectionStorageInterface:: |
public | function | Gets the label for the object using the sections. | 4 |
SectionStorageInterface:: |
public | function | Saves the sections. | 4 |