You are here

public function RulesDefaultEventHandler::getContextDefinition in Rules 8.3

Gets a specific context definition of the plugin.

Parameters

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

Return value

\Drupal\rules\Context\ContextDefinitionInterface The definition against which the context value must validate.

Throws

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

Overrides RulesEventHandlerInterface::getContextDefinition

File

src/Core/RulesDefaultEventHandler.php, line 27

Class

RulesDefaultEventHandler
Default event handler class.

Namespace

Drupal\rules\Core

Code

public function getContextDefinition($name) {
  $definitions = $this
    ->getContextDefinitions();
  if (empty($definitions[$name])) {
    throw new ContextException(sprintf("The context '%s' is not a valid context.", $name));
  }
  return $definitions[$name];
}