You are here

public function RulesConditionBase::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

4 calls to RulesConditionBase::getContextValue()
DataComparison::refineContextDefinitions in src/Plugin/Condition/DataComparison.php
Refines used and provided context definitions based upon context values.
EntityIsOfBundle::assertMetadata in src/Plugin/Condition/EntityIsOfBundle.php
Asserts additional metadata for the selected data.
RulesConditionBase::evaluate in src/Core/RulesConditionBase.php
Evaluates the condition and returns TRUE or FALSE accordingly.
TestTextCondition::evaluate in tests/modules/rules_test/src/Plugin/Condition/TestTextCondition.php
Evaluates the condition and returns TRUE or FALSE accordingly.

File

src/Core/RulesConditionBase.php, line 38

Class

RulesConditionBase
Base class for rules conditions.

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;
    }
  }
}