You are here

public function RulesActionBase::getContextValue in Rules 8.3

Gets the value for a defined context.

Parameters

string $name: The name of the context in the plugin configuration.

Return value

mixed The currently set context value.

Throws

\Drupal\Component\Plugin\Exception\PluginException If the requested context is not set.

Overrides ContextAwarePluginBase::getContextValue

6 calls to RulesActionBase::getContextValue()
DataConvert::refineContextDefinitions in src/Plugin/RulesAction/DataConvert.php
Refines used and provided context definitions based upon context values.
EntityCreate::refineContextDefinitions in src/Plugin/RulesAction/EntityCreate.php
Refines used and provided context definitions based upon context values.
EntityFetchByField::refineContextDefinitions in src/Plugin/RulesAction/EntityFetchByField.php
Refines used and provided context definitions based upon context values.
EntityFetchById::refineContextDefinitions in src/Plugin/RulesAction/EntityFetchById.php
Refines used and provided context definitions based upon context values.
RulesActionBase::execute in src/Core/RulesActionBase.php
Executes the plugin.

... See full list

File

src/Core/RulesActionBase.php, line 30

Class

RulesActionBase
Base class for rules actions.

Namespace

Drupal\rules\Core

Code

public function getContextValue($name) {
  try {
    return parent::getContextValue($name);
  } catch (ContextException $e) {

    // Catch the undocumented exception thrown when no context value is set
    // for a required context.
    // @todo Remove once https://www.drupal.org/node/2677162 is fixed.
    if (strpos($e
      ->getMessage(), 'context is required') === FALSE) {
      throw $e;
    }
  }
}