class RulesUiRouteEnhancer in Rules 8.3
Enhances routes with the specified RulesUI.
Routes have the plugin ID of the active RulesUI instance set on the _rules_ui option. Based upon that information, this enhances adds the following parameters to the routes:
- rules_ui_handler: The RulesUI handler, as specified by the plugin.
- rules_component: The rules component being edited, as provided by the handler.
Hierarchy
- class \Drupal\rules\Routing\RulesUiRouteEnhancer implements EnhancerInterface
Expanded class hierarchy of RulesUiRouteEnhancer
1 string reference to 'RulesUiRouteEnhancer'
1 service uses RulesUiRouteEnhancer
File
- src/
Routing/ RulesUiRouteEnhancer.php, line 20
Namespace
Drupal\rules\RoutingView source
class RulesUiRouteEnhancer implements EnhancerInterface {
/**
* The rules_ui plugin manager.
*
* @var \Drupal\rules\Ui\RulesUiManagerInterface
*/
protected $rulesUiManager;
/**
* Constructs the object.
*
* @param \Drupal\rules\Ui\RulesUiManagerInterface $rules_ui_manager
* The rules_ui plugin manager.
*/
public function __construct(RulesUiManagerInterface $rules_ui_manager) {
$this->rulesUiManager = $rules_ui_manager;
}
/**
* {@inheritdoc}
*/
public function enhance(array $defaults, Request $request) {
/** @var \Symfony\Component\Routing\Route $route */
$route = $defaults[RouteObjectInterface::ROUTE_OBJECT];
if ($plugin_id = $route
->getOption('_rules_ui')) {
$defaults['rules_ui_handler'] = $this->rulesUiManager
->createInstance($plugin_id);
}
return $defaults;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RulesUiRouteEnhancer:: |
protected | property | The rules_ui plugin manager. | |
RulesUiRouteEnhancer:: |
public | function | Update the defaults based on its own data and the request. | |
RulesUiRouteEnhancer:: |
public | function | Constructs the object. |