public function EventMeta::trigger in RNG - Events and Registrations 3.x
Same name and namespace in other branches
- 8.2 src/EventMeta.php \Drupal\rng\EventMeta::trigger()
- 8 src/EventMeta.php \Drupal\rng\EventMeta::trigger()
Manually triggers rules for this event.
Parameters
string $trigger: The trigger ID.
array $context: Mixed context.
Overrides EventMetaInterface::trigger
File
- src/
EventMeta.php, line 432
Class
- EventMeta
- Meta event wrapper for RNG.
Namespace
Drupal\rngCode
public function trigger($trigger, $context = []) {
$context['event'] = $this
->getEvent();
foreach ($this
->getRules($trigger) as $rule) {
if ($rule
->evaluateConditions()) {
foreach ($rule
->getActions() as $action) {
$action
->execute($context);
}
}
}
}