diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md index 000fd2fc059d..8bbaef3642e8 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 ab39f1fed309..ceed974c6f02 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 c8a9d1812eb8..3797873acb94 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 dcc15b6a2450..fd8f6b402322 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 33530aeb82c4..432892dbbc2a 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.
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: