
| Current Path : /var/www/html/c12park/web/modules/contrib/ctools/src/Routing/Enhancer/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/c12park/web/modules/contrib/ctools/src/Routing/Enhancer/WizardEnhancer.php |
<?php
namespace Drupal\ctools\Routing\Enhancer;
use Drupal\Core\Routing\EnhancerInterface;
use Drupal\Core\Routing\RouteObjectInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Route;
/**
* Sets the request format onto the request object.
*/
class WizardEnhancer implements EnhancerInterface {
/**
* {@inheritdoc}
*/
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;
}
/**
* Returns if current route use ctools default parameters.
*
* @param \Symfony\Component\Routing\Route $route
* The route to check.
*
* @return bool
* TRUE if the route use one of ctools route default parameters or FALSE.
*/
public function isApplicable(Route $route) {
return !$route->hasDefault('_controller') && ($route->hasDefault('_wizard') || $route->hasDefault('_entity_wizard'));
}
}