function RulesUiRouteEnhancer::enhance

Overrides EnhancerInterface::enhance

File

src/Routing/RulesUiRouteEnhancer.php, line 42

Class

RulesUiRouteEnhancer
Enhances routes with the specified RulesUI.

Namespace

Drupal\rules\Routing

Code

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;
}