function SimpleConfigSectionStorage::deriveContextsFromRoute
Same name and namespace in other branches
- 9 core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/SimpleConfigSectionStorage.php \Drupal\layout_builder_test\Plugin\SectionStorage\SimpleConfigSectionStorage::deriveContextsFromRoute()
- 8.9.x core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/SimpleConfigSectionStorage.php \Drupal\layout_builder_test\Plugin\SectionStorage\SimpleConfigSectionStorage::deriveContextsFromRoute()
- 10 core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/SimpleConfigSectionStorage.php \Drupal\layout_builder_test\Plugin\SectionStorage\SimpleConfigSectionStorage::deriveContextsFromRoute()
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().
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
\Drupal\Core\Plugin\Context\ContextInterface[] The available plugin contexts.
Overrides SectionStorageInterface::deriveContextsFromRoute
File
-
core/
modules/ layout_builder/ tests/ modules/ layout_builder_test/ src/ Plugin/ SectionStorage/ SimpleConfigSectionStorage.php, line 147
Class
- SimpleConfigSectionStorage
- Provides section storage utilizing simple config.
Namespace
Drupal\layout_builder_test\Plugin\SectionStorageCode
public function deriveContextsFromRoute($value, $definition, $name, array $defaults) {
$contexts['config_id'] = new Context(new ContextDefinition('string'), $value ?: $defaults['id']);
return $contexts;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.