WizardEnhancer.php in Chaos Tool Suite (ctools) 8.3
File
src/Routing/Enhancer/WizardEnhancer.php
View source
<?php
namespace Drupal\ctools\Routing\Enhancer;
use Drupal\Core\Routing\EnhancerInterface;
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Route;
class WizardEnhancer implements EnhancerInterface {
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;
}
public function isApplicable(Route $route) {
return !$route
->hasDefault('_controller') && ($route
->hasDefault('_wizard') || $route
->hasDefault('_entity_wizard'));
}
}