You are here

public function Library::extractIdFromRoute in Layout builder library 8

Configures the plugin based on route values.

@internal This should only be called during section storage instantiation.

Parameters

mixed $value: The raw value.

mixed $definition: The parameter definition provided in the route options.

string $name: The name of the parameter.

array $defaults: The route defaults array.

Return value

string|null The section storage ID if it could be extracted, NULL otherwise.

Overrides SectionStorageInterface::extractIdFromRoute

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.

File

src/Plugin/SectionStorage/Library.php, line 191

Class

Library
Defines a class for library based layout storage.

Namespace

Drupal\layout_library\Plugin\SectionStorage

Code

public function extractIdFromRoute($value, $definition, $name, array $defaults) {
  @trigger_error('\\Drupal\\layout_builder\\SectionStorageInterface::extractIdFromRoute() is deprecated in drupal:8.7.0 and will be removed before drupal:9.0.0. \\Drupal\\layout_builder\\SectionStorageInterface::deriveContextsFromRoute() should be used instead. See https://www.drupal.org/node/3016262', E_USER_DEPRECATED);
  return $value ?: $defaults['layout'];
}