interface SectionStorageManagerInterface implements DiscoveryInterface (View source)

Provides the interface for a plugin manager of section storage types.

Methods

mixed
getDefinition(string $plugin_id, bool $exception_on_invalid = TRUE)

Gets a specific plugin definition.

array
getDefinitions()

Gets the definition of all plugins for this type.

bool
hasDefinition(string $plugin_id)

Indicates if a specific plugin definition exists.

load(string $type, array $contexts = [])

Loads a section storage with the provided contexts applied.

findByContext(array $contexts, RefinableCacheableDependencyInterface $cacheability)

Finds the section storage to load based on available contexts.

loadEmpty(string $type)

Loads a section storage with no associated section list.

Details

mixed getDefinition(string $plugin_id, bool $exception_on_invalid = TRUE)

Gets a specific plugin definition.

Parameters

string $plugin_id

A plugin id.

bool $exception_on_invalid

(optional) If TRUE, an invalid plugin ID will throw an exception.

Return Value

mixed

A plugin definition, or NULL if the plugin ID is invalid and $exception_on_invalid is FALSE.

Exceptions

PluginNotFoundException

array getDefinitions()

Gets the definition of all plugins for this type.

Return Value

array

An array of plugin definitions (empty array if no definitions were found). Keys are plugin IDs.

See also

FilteredPluginManagerInterface::getFilteredDefinitions

bool hasDefinition(string $plugin_id)

Indicates if a specific plugin definition exists.

Parameters

string $plugin_id

A plugin ID.

Return Value

bool

TRUE if the definition exists, FALSE otherwise.

SectionStorageInterface|null load(string $type, array $contexts = [])

Loads a section storage with the provided contexts applied.

Parameters

string $type

The section storage type.

array $contexts

(optional) The contexts available for this storage to use.

Return Value

SectionStorageInterface|null

The section storage or NULL if its context requirements are not met.

SectionStorageInterface|null findByContext(array $contexts, RefinableCacheableDependencyInterface $cacheability)

Finds the section storage to load based on available contexts.

Parameters

array $contexts

The contexts which should be used to determine which storage to return.

RefinableCacheableDependencyInterface $cacheability

Refinable cacheability object, which will be populated based on the cacheability of each section storage candidate. After calling this method this parameter will reflect the cacheability information used to determine the correct section storage. This must be associated with any output that uses the result of this method.

Return Value

SectionStorageInterface|null

The section storage if one matched all contexts, or NULL otherwise.

See also

RefinableCacheableDependencyInterface

SectionStorageInterface loadEmpty(string $type)

internal  Section storage relies on context to load section lists. Use ::load() when that context is available. This method is intended for use by collaborators of the plugins in build-time situations when section storage type must be consulted.
 

Loads a section storage with no associated section list.

Parameters

string $type

The type of the section storage being instantiated.

Return Value

SectionStorageInterface

The section storage.