/**
  * Maps provided context values from the plugin to the Rules state.
  *
  * @param ContextProviderInterface $plugin
  *   The plugin where the context values are extracted.
  * @param \Drupal\rules\Engine\RulesStateInterface $state
  *   The Rules state where the context variables are added.
  */
 protected function mapProvidedContext(ContextProviderInterface $plugin, RulesStateInterface $state)
 {
     $provides = $plugin->getProvidedContextDefinitions();
     foreach ($provides as $name => $provided_definition) {
         // Avoid name collisions in the rules state: provided variables can be
         // renamed.
         if (isset($this->configuration['provides_mapping'][$name])) {
             $state->addVariable($this->configuration['provides_mapping'][$name], $plugin->getProvidedContext($name));
         } else {
             $state->addVariable($name, $plugin->getProvidedContext($name));
         }
     }
 }