Mercurial > hg > isophonics-drupal-site
annotate core/modules/layout_builder/src/Routing/LayoutBuilderRouteEnhancer.php @ 15:e200cb7efeb3
Update Drupal core to 8.5.3 via Composer
author | Chris Cannam |
---|---|
date | Thu, 26 Apr 2018 11:26:54 +0100 |
parents | 1fec387a4317 |
children |
rev | line source |
---|---|
Chris@14 | 1 <?php |
Chris@14 | 2 |
Chris@14 | 3 namespace Drupal\layout_builder\Routing; |
Chris@14 | 4 |
Chris@14 | 5 use Drupal\Core\Routing\EnhancerInterface; |
Chris@14 | 6 use Symfony\Cmf\Component\Routing\RouteObjectInterface; |
Chris@14 | 7 use Symfony\Component\HttpFoundation\Request; |
Chris@14 | 8 |
Chris@14 | 9 /** |
Chris@14 | 10 * Converts the query parameter for layout rebuild status to a route default. |
Chris@14 | 11 * |
Chris@14 | 12 * @internal |
Chris@14 | 13 */ |
Chris@14 | 14 class LayoutBuilderRouteEnhancer implements EnhancerInterface { |
Chris@14 | 15 |
Chris@14 | 16 /** |
Chris@14 | 17 * {@inheritdoc} |
Chris@14 | 18 */ |
Chris@14 | 19 public function enhance(array $defaults, Request $request) { |
Chris@14 | 20 $route = $defaults[RouteObjectInterface::ROUTE_OBJECT]; |
Chris@14 | 21 if ($route->hasOption('_layout_builder')) { |
Chris@14 | 22 $defaults['is_rebuilding'] = (bool) $request->query->get('layout_is_rebuilding', FALSE); |
Chris@14 | 23 } |
Chris@14 | 24 return $defaults; |
Chris@14 | 25 } |
Chris@14 | 26 |
Chris@14 | 27 } |