public function DefaultsSectionStorage::setContext in Drupal 8
Same name and namespace in other branches
- 9 core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php \Drupal\layout_builder\Plugin\SectionStorage\DefaultsSectionStorage::setContext()
Set a context on this plugin.
Parameters
string $name: The name of the context in the plugin configuration.
\Drupal\Component\Plugin\Context\ContextInterface $context: The context object to set.
Overrides ContextAwarePluginBase::setContext
File
- core/
modules/ layout_builder/ src/ Plugin/ SectionStorage/ DefaultsSectionStorage.php, line 440
Class
- DefaultsSectionStorage
- Defines the 'defaults' section storage type.
Namespace
Drupal\layout_builder\Plugin\SectionStorageCode
public function setContext($name, ComponentContextInterface $context) {
// Set the view mode context based on the display context.
if ($name === 'display') {
$this
->setContextValue('view_mode', $context
->getContextValue()
->getMode());
}
parent::setContext($name, $context);
}