trait RulesUiHandlerTrait in Rules 8.3
Trait for getting the rules_ui_handler attribute of the current request.
Note that the current route must have the _rules_ui option set for the handler being available. This is done automatically for routes generated for the rules_ui (via \Drupal\rules\Routing\RulesUiRouteSubscriber).
Hierarchy
- trait \Drupal\rules\Ui\RulesUiHandlerTrait
3 files declare their use of RulesUiHandlerTrait
- ActionForm.php in src/
Form/ Expression/ ActionForm.php - ConditionForm.php in src/
Form/ Expression/ ConditionForm.php - ExpressionContainerFormBase.php in src/
Form/ Expression/ ExpressionContainerFormBase.php
File
- src/
Ui/ RulesUiHandlerTrait.php, line 12
Namespace
Drupal\rules\UiView source
trait RulesUiHandlerTrait {
/**
* The rules UI handler.
*
* @var \Drupal\rules\Ui\RulesUiHandlerInterface
*/
protected $rulesUiHandler;
/**
* Gets the rules UI handler of the current route.
*
* @return \Drupal\rules\Ui\RulesUiHandlerInterface|null
* The handler, or NULL if this is no rules_ui enabled route.
*/
public function getRulesUiHandler() {
if (!isset($this->rulesUiHandler)) {
$this->rulesUiHandler = \Drupal::request()->attributes
->get('rules_ui_handler');
}
return $this->rulesUiHandler;
}
/**
* Sets the Rules UI handler.
*
* @param \Drupal\rules\Ui\RulesUiHandlerInterface $rules_ui_handler
* The Rules UI handler to set.
*
* @return $this
*/
public function setRulesUiHandler(RulesUiHandlerInterface $rules_ui_handler) {
$this->rulesUiHandler = $rules_ui_handler;
return $this;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RulesUiHandlerTrait:: |
protected | property | The rules UI handler. | |
RulesUiHandlerTrait:: |
public | function | Gets the rules UI handler of the current route. | |
RulesUiHandlerTrait:: |
public | function | Sets the Rules UI handler. |