Mercurial > hg > isophonics-drupal-site
diff core/modules/layout_builder/src/Routing/LayoutBuilderRouteEnhancer.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/modules/layout_builder/src/Routing/LayoutBuilderRouteEnhancer.php Mon Apr 23 09:46:53 2018 +0100 @@ -0,0 +1,27 @@ +<?php + +namespace Drupal\layout_builder\Routing; + +use Drupal\Core\Routing\EnhancerInterface; +use Symfony\Cmf\Component\Routing\RouteObjectInterface; +use Symfony\Component\HttpFoundation\Request; + +/** + * Converts the query parameter for layout rebuild status to a route default. + * + * @internal + */ +class LayoutBuilderRouteEnhancer implements EnhancerInterface { + + /** + * {@inheritdoc} + */ + public function enhance(array $defaults, Request $request) { + $route = $defaults[RouteObjectInterface::ROUTE_OBJECT]; + if ($route->hasOption('_layout_builder')) { + $defaults['is_rebuilding'] = (bool) $request->query->get('layout_is_rebuilding', FALSE); + } + return $defaults; + } + +}