Loading core/core.services.yml +4 −1 Original line number Diff line number Diff line Loading @@ -959,7 +959,7 @@ services: arguments: ['@event_dispatcher', '@controller_resolver', '@request_stack', '@http_kernel.controller.argument_resolver', true] http_kernel.controller.argument_resolver: class: Symfony\Component\HttpKernel\Controller\ArgumentResolver arguments: ['@http_kernel.controller.argument_metadata_factory', ['@argument_resolver.request_attribute', '@argument_resolver.request', '@argument_resolver.psr7_request', '@argument_resolver.route_match', '@argument_resolver.default']] arguments: ['@http_kernel.controller.argument_metadata_factory', ['@argument_resolver.request_attribute', '@argument_resolver.request', '@argument_resolver.psr7_request', '@argument_resolver.route_match', '@argument_resolver.query_parameter', '@argument_resolver.default']] Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface: '@http_kernel.controller.argument_resolver' http_kernel.controller.argument_metadata_factory: class: Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadataFactory Loading @@ -981,6 +981,9 @@ services: argument_resolver.default: class: Symfony\Component\HttpKernel\Controller\ArgumentResolver\DefaultValueResolver public: false argument_resolver.query_parameter: class: Symfony\Component\HttpKernel\Controller\ArgumentResolver\QueryParameterValueResolver public: false http_middleware.content_length: class: Drupal\Core\StackMiddleware\ContentLength tags: Loading core/modules/system/src/Controller/ThemeController.php +82 −110 Original line number Diff line number Diff line Loading @@ -11,8 +11,7 @@ use Drupal\Core\Extension\ThemeHandlerInterface; use Drupal\Core\Extension\ThemeInstallerInterface; use Drupal\system\Form\ThemeExperimentalConfirmForm; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Attribute\MapQueryParameter; /** * Controller for theme handling. Loading Loading @@ -62,21 +61,15 @@ public function __construct(ThemeHandlerInterface $theme_handler, ThemeExtension /** * Uninstalls a theme. * * @param \Symfony\Component\HttpFoundation\Request $request * A request object containing a theme name and a valid token. * @param string $theme * The theme name. * * @return \Symfony\Component\HttpFoundation\RedirectResponse * Redirects back to the appearance admin page. * * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException * Throws access denied when no theme or token is set in the request or when * the token is invalid. */ public function uninstall(Request $request) { $theme = $request->query->get('theme'); public function uninstall(#[MapQueryParameter] string $theme) { $config = $this->config('system.theme'); if (isset($theme)) { // Get current list of themes. $themes = $this->themeHandler->listInfo(); Loading @@ -98,27 +91,17 @@ public function uninstall(Request $request) { return $this->redirect('system.themes_page'); } throw new AccessDeniedHttpException(); } /** * Installs a theme. * * @param \Symfony\Component\HttpFoundation\Request $request * A request object containing a theme name and a valid token. * @param string $theme * The theme name. * * @return \Symfony\Component\HttpFoundation\RedirectResponse|array * Redirects back to the appearance admin page or the confirmation form * if an experimental theme will be installed. * * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException * Throws access denied when no theme or token is set in the request or when * the token is invalid. */ public function install(Request $request) { $theme = $request->query->get('theme'); if (isset($theme)) { public function install(#[MapQueryParameter] string $theme) { // Display confirmation form in case of experimental theme. if ($this->willInstallExperimentalTheme($theme)) { return $this->formBuilder()->getForm(ThemeExperimentalConfirmForm::class, $theme); Loading Loading @@ -156,9 +139,6 @@ public function install(Request $request) { return $this->redirect('system.themes_page'); } throw new AccessDeniedHttpException(); } /** * Checks if the given theme requires the installation of experimental themes. * Loading @@ -185,21 +165,16 @@ protected function willInstallExperimentalTheme($theme) { /** * Set the default theme. * * @param \Symfony\Component\HttpFoundation\Request $request * A request object containing a theme name. * @param string $theme * The theme name. * * @return \Symfony\Component\HttpFoundation\RedirectResponse|array * Redirects back to the appearance admin page or the confirmation form * if an experimental theme will be installed. * * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException * Throws access denied when no theme is set in the request. */ public function setDefaultTheme(Request $request) { public function setDefaultTheme(#[MapQueryParameter] string $theme) { $config = $this->configFactory->getEditable('system.theme'); $theme = $request->query->get('theme'); if (isset($theme)) { // Get current list of themes. $themes = $this->themeHandler->listInfo(); // Display confirmation form if an experimental theme is being installed. Loading Loading @@ -235,9 +210,6 @@ public function setDefaultTheme(Request $request) { } return $this->redirect('system.themes_page'); } throw new AccessDeniedHttpException(); } } Loading
core/core.services.yml +4 −1 Original line number Diff line number Diff line Loading @@ -959,7 +959,7 @@ services: arguments: ['@event_dispatcher', '@controller_resolver', '@request_stack', '@http_kernel.controller.argument_resolver', true] http_kernel.controller.argument_resolver: class: Symfony\Component\HttpKernel\Controller\ArgumentResolver arguments: ['@http_kernel.controller.argument_metadata_factory', ['@argument_resolver.request_attribute', '@argument_resolver.request', '@argument_resolver.psr7_request', '@argument_resolver.route_match', '@argument_resolver.default']] arguments: ['@http_kernel.controller.argument_metadata_factory', ['@argument_resolver.request_attribute', '@argument_resolver.request', '@argument_resolver.psr7_request', '@argument_resolver.route_match', '@argument_resolver.query_parameter', '@argument_resolver.default']] Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface: '@http_kernel.controller.argument_resolver' http_kernel.controller.argument_metadata_factory: class: Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadataFactory Loading @@ -981,6 +981,9 @@ services: argument_resolver.default: class: Symfony\Component\HttpKernel\Controller\ArgumentResolver\DefaultValueResolver public: false argument_resolver.query_parameter: class: Symfony\Component\HttpKernel\Controller\ArgumentResolver\QueryParameterValueResolver public: false http_middleware.content_length: class: Drupal\Core\StackMiddleware\ContentLength tags: Loading
core/modules/system/src/Controller/ThemeController.php +82 −110 Original line number Diff line number Diff line Loading @@ -11,8 +11,7 @@ use Drupal\Core\Extension\ThemeHandlerInterface; use Drupal\Core\Extension\ThemeInstallerInterface; use Drupal\system\Form\ThemeExperimentalConfirmForm; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Attribute\MapQueryParameter; /** * Controller for theme handling. Loading Loading @@ -62,21 +61,15 @@ public function __construct(ThemeHandlerInterface $theme_handler, ThemeExtension /** * Uninstalls a theme. * * @param \Symfony\Component\HttpFoundation\Request $request * A request object containing a theme name and a valid token. * @param string $theme * The theme name. * * @return \Symfony\Component\HttpFoundation\RedirectResponse * Redirects back to the appearance admin page. * * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException * Throws access denied when no theme or token is set in the request or when * the token is invalid. */ public function uninstall(Request $request) { $theme = $request->query->get('theme'); public function uninstall(#[MapQueryParameter] string $theme) { $config = $this->config('system.theme'); if (isset($theme)) { // Get current list of themes. $themes = $this->themeHandler->listInfo(); Loading @@ -98,27 +91,17 @@ public function uninstall(Request $request) { return $this->redirect('system.themes_page'); } throw new AccessDeniedHttpException(); } /** * Installs a theme. * * @param \Symfony\Component\HttpFoundation\Request $request * A request object containing a theme name and a valid token. * @param string $theme * The theme name. * * @return \Symfony\Component\HttpFoundation\RedirectResponse|array * Redirects back to the appearance admin page or the confirmation form * if an experimental theme will be installed. * * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException * Throws access denied when no theme or token is set in the request or when * the token is invalid. */ public function install(Request $request) { $theme = $request->query->get('theme'); if (isset($theme)) { public function install(#[MapQueryParameter] string $theme) { // Display confirmation form in case of experimental theme. if ($this->willInstallExperimentalTheme($theme)) { return $this->formBuilder()->getForm(ThemeExperimentalConfirmForm::class, $theme); Loading Loading @@ -156,9 +139,6 @@ public function install(Request $request) { return $this->redirect('system.themes_page'); } throw new AccessDeniedHttpException(); } /** * Checks if the given theme requires the installation of experimental themes. * Loading @@ -185,21 +165,16 @@ protected function willInstallExperimentalTheme($theme) { /** * Set the default theme. * * @param \Symfony\Component\HttpFoundation\Request $request * A request object containing a theme name. * @param string $theme * The theme name. * * @return \Symfony\Component\HttpFoundation\RedirectResponse|array * Redirects back to the appearance admin page or the confirmation form * if an experimental theme will be installed. * * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException * Throws access denied when no theme is set in the request. */ public function setDefaultTheme(Request $request) { public function setDefaultTheme(#[MapQueryParameter] string $theme) { $config = $this->configFactory->getEditable('system.theme'); $theme = $request->query->get('theme'); if (isset($theme)) { // Get current list of themes. $themes = $this->themeHandler->listInfo(); // Display confirmation form if an experimental theme is being installed. Loading Loading @@ -235,9 +210,6 @@ public function setDefaultTheme(Request $request) { } return $this->redirect('system.themes_page'); } throw new AccessDeniedHttpException(); } }