RulesReactionController.php
View source
<?php
namespace Drupal\rules\Controller;
use Drupal\Core\Controller\ControllerBase;
use Drupal\rules\Entity\ReactionRuleConfig;
class RulesReactionController extends ControllerBase {
public function enableConfig(ReactionRuleConfig $rules_reaction_rule) {
$rules_reaction_rule->enable()
->save();
$this->getLogger('rules')
->notice('The reaction rule %label has been enabled.', [
'%label' => $rules_reaction_rule->label(),
]);
$this->messenger()
->addMessage($this->t('The reaction rule %label has been enabled.', [
'%label' => $rules_reaction_rule->label(),
]));
return $this->redirect('entity.rules_reaction_rule.collection');
}
public function disableConfig(ReactionRuleConfig $rules_reaction_rule) {
$rules_reaction_rule->disable()
->save();
$this->getLogger('rules')
->notice('The reaction rule %label has been disabled.', [
'%label' => $rules_reaction_rule->label(),
]);
$this->messenger()
->addMessage($this->t('The reaction rule %label has been disabled.', [
'%label' => $rules_reaction_rule->label(),
]));
return $this->redirect('entity.rules_reaction_rule.collection');
}
}