function WizardEnhancer::enhance

Same name in other branches
  1. 4.0.x src/Routing/Enhancer/WizardEnhancer.php \Drupal\ctools\Routing\Enhancer\WizardEnhancer::enhance()

Overrides EnhancerInterface::enhance

File

src/Routing/Enhancer/WizardEnhancer.php, line 18

Class

WizardEnhancer
Sets the request format onto the request object.

Namespace

Drupal\ctools\Routing\Enhancer

Code

public function enhance(array $defaults, Request $request) {
    $route = $defaults[RouteObjectInterface::ROUTE_OBJECT];
    if (!$this->isApplicable($route)) {
        return $defaults;
    }
    if (!empty($defaults['_wizard'])) {
        $defaults['_controller'] = 'ctools.wizard.form:getContentResult';
    }
    if (!empty($defaults['_entity_wizard'])) {
        $defaults['_controller'] = 'ctools.wizard.entity.form:getContentResult';
    }
    return $defaults;
}