RulesDefaultEventHandler.php in Rules 8.3
File
src/Core/RulesDefaultEventHandler.php
View source
<?php
namespace Drupal\rules\Core;
use Drupal\Component\Plugin\Exception\ContextException;
use Drupal\Core\Plugin\PluginBase;
class RulesDefaultEventHandler extends PluginBase implements RulesEventHandlerInterface {
public function getContextDefinitions() {
$definition = $this
->getPluginDefinition();
if ($this instanceof RulesConfigurableEventHandlerInterface) {
$this
->refineContextDefinitions();
}
return !empty($definition['context_definitions']) ? $definition['context_definitions'] : [];
}
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];
}
}