public function ContextAwarePluginTrait::setContextMapping in Drupal 10
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php \Drupal\Core\Plugin\ContextAwarePluginTrait::setContextMapping()
File
- core/
lib/ Drupal/ Core/ Plugin/ ContextAwarePluginTrait.php, line 104
Class
- ContextAwarePluginTrait
- Provides a trait to add context-aware functionality to plugins.
Namespace
Drupal\Core\PluginCode
public function setContextMapping(array $context_mapping) {
if ($this instanceof ConfigurableInterface) {
$configuration = $this
->getConfiguration();
$configuration['context_mapping'] = array_filter($context_mapping);
$this
->setConfiguration($configuration);
}
else {
$this->configuration['context_mapping'] = $context_mapping;
}
return $this;
}