function ContextAwarePluginBase::setContextMapping

Overrides ContextAwarePluginInterface::setContextMapping

1 call to ContextAwarePluginBase::setContextMapping()
ConditionPluginBase::submitConfigurationForm in core/lib/Drupal/Core/Condition/ConditionPluginBase.php
Form submission handler.

File

core/lib/Drupal/Core/Plugin/ContextAwarePluginBase.php, line 88

Class

ContextAwarePluginBase
Base class for plugins that are context aware.

Namespace

Drupal\Core\Plugin

Code

public function setContextMapping(array $context_mapping) {
    if (PluginHelper::isConfigurable($this)) {
        $configuration = $this->getConfiguration();
        $configuration['context_mapping'] = array_filter($context_mapping);
        $this->setConfiguration($configuration);
    }
    else {
        $this->configuration['context_mapping'] = $context_mapping;
    }
    return $this;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.