From c22d783696d65f36384f166b6d1a56c426517ac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edi=20Modri=C4=87?= Date: Thu, 19 Oct 2017 17:12:11 +0200 Subject: [PATCH] [Form] Add useDefaultThemes flag to the interfaces --- UPGRADE-4.0.md | 2 ++ src/Symfony/Component/Form/AbstractRendererEngine.php | 6 ++---- src/Symfony/Component/Form/FormRenderer.php | 5 ++--- src/Symfony/Component/Form/FormRendererEngineInterface.php | 4 ++-- src/Symfony/Component/Form/FormRendererInterface.php | 4 ++-- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md index 000fd2fc059d8..8bbaef3642e84 100644 --- a/UPGRADE-4.0.md +++ b/UPGRADE-4.0.md @@ -326,6 +326,8 @@ Form } ``` + * `FormRendererInterface::setTheme` and `FormRendererEngineInterface::setTheme` have a new optional argument `$useDefaultThemes` with a default value set to `true`. + FrameworkBundle --------------- diff --git a/src/Symfony/Component/Form/AbstractRendererEngine.php b/src/Symfony/Component/Form/AbstractRendererEngine.php index ab39f1fed309b..ceed974c6f020 100644 --- a/src/Symfony/Component/Form/AbstractRendererEngine.php +++ b/src/Symfony/Component/Form/AbstractRendererEngine.php @@ -62,15 +62,13 @@ public function __construct(array $defaultThemes = array()) /** * {@inheritdoc} */ - public function setTheme(FormView $view, $themes /*, $useDefaultThemes = true */) + public function setTheme(FormView $view, $themes, $useDefaultThemes = true) { $cacheKey = $view->vars[self::CACHE_KEY_VAR]; // Do not cast, as casting turns objects into arrays of properties $this->themes[$cacheKey] = is_array($themes) ? $themes : array($themes); - - $args = func_get_args(); - $this->useDefaultThemes[$cacheKey] = isset($args[2]) ? (bool) $args[2] : true; + $this->useDefaultThemes[$cacheKey] = (bool) $useDefaultThemes; // Unset instead of resetting to an empty array, in order to allow // implementations (like TwigRendererEngine) to check whether $cacheKey diff --git a/src/Symfony/Component/Form/FormRenderer.php b/src/Symfony/Component/Form/FormRenderer.php index c8a9d1812eb8b..3797873acb94f 100644 --- a/src/Symfony/Component/Form/FormRenderer.php +++ b/src/Symfony/Component/Form/FormRenderer.php @@ -70,10 +70,9 @@ public function getEngine() /** * {@inheritdoc} */ - public function setTheme(FormView $view, $themes /*, $useDefaultThemes = true */) + public function setTheme(FormView $view, $themes, $useDefaultThemes = true) { - $args = func_get_args(); - $this->engine->setTheme($view, $themes, isset($args[2]) ? (bool) $args[2] : true); + $this->engine->setTheme($view, $themes, $useDefaultThemes); } /** diff --git a/src/Symfony/Component/Form/FormRendererEngineInterface.php b/src/Symfony/Component/Form/FormRendererEngineInterface.php index dcc15b6a2450f..fd8f6b4023220 100644 --- a/src/Symfony/Component/Form/FormRendererEngineInterface.php +++ b/src/Symfony/Component/Form/FormRendererEngineInterface.php @@ -25,9 +25,9 @@ interface FormRendererEngineInterface * @param mixed $themes The theme(s). The type of these themes * is open to the implementation. * @param bool $useDefaultThemes If true, will use default themes specified - * in the engine, will be added to the interface in 4.0 + * in the engine */ - public function setTheme(FormView $view, $themes /*, $useDefaultThemes = true */); + public function setTheme(FormView $view, $themes, $useDefaultThemes = true); /** * Returns the resource for a block name. diff --git a/src/Symfony/Component/Form/FormRendererInterface.php b/src/Symfony/Component/Form/FormRendererInterface.php index 33530aeb82c47..432892dbbc2ad 100644 --- a/src/Symfony/Component/Form/FormRendererInterface.php +++ b/src/Symfony/Component/Form/FormRendererInterface.php @@ -32,9 +32,9 @@ public function getEngine(); * @param mixed $themes The theme(s). The type of these themes * is open to the implementation. * @param bool $useDefaultThemes If true, will use default themes specified - * in the renderer, will be added to the interface in 4.0 + * in the renderer */ - public function setTheme(FormView $view, $themes /*, $useDefaultThemes = true */); + public function setTheme(FormView $view, $themes, $useDefaultThemes = true); /** * Renders a named block of the form theme. pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy