8000 minor #24628 [Form] Add $useDefaultThemes flag to the interfaces (emo… · symfony/symfony@b2a4acf · GitHub
[go: up one dir, main page]

Skip to content

Commit b2a4acf

Browse files
committed
minor #24628 [Form] Add $useDefaultThemes flag to the interfaces (emodric)
This PR was merged into the 4.0-dev branch. Discussion ---------- [Form] Add $useDefaultThemes flag to the interfaces | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | yes | Deprecations? | no | Tests pass? | yes | Fixed tickets | N/A | License | MIT | Doc PR | N/A Followup to #22610 to add `$useDefaultThemes` to the interfaces as discussed in the issue. Commits ------- c22d783 [Form] Add useDefaultThemes flag to the interfaces
2 parents b935b93 + c22d783 commit b2a4acf

File tree

5 files changed

+10
-11
lines changed

5 files changed

+10
-11
lines changed

UPGRADE-4.0.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,8 @@ Form
326326
}
327327
```
328328

329+
* `FormRendererInterface::setTheme` and `FormRendererEngineInterface::setTheme` have a new optional argument `$useDefaultThemes` with a default value set to `true`.
330+
329331
FrameworkBundle
330332
---------------
331333

src/Symfony/Component/Form/AbstractRendererEngine.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,13 @@ public function __construct(array $defaultThemes = array())
6262
/**
6363
* {@inheritdoc}
6464
*/
65-
public function setTheme(FormView $view, $themes /*, $useDefaultThemes = true */)
65+
public function setTheme(FormView $view, $themes, $useDefaultThemes = true)
6666
{
6767
$cacheKey = $view->vars[self::CACHE_KEY_VAR];
6868

6969
// Do not cast, as casting turns objects into arrays of properties
7070
$this->themes[$cacheKey] = is_array($themes) ? $themes : array($themes);
71-
72-
$args = func_get_args();
73-
$this->useDefaultThemes[$cacheKey] = isset($args[2]) ? (bool) $args[2] : true;
71+
$this->useDefaultThemes[$cacheKey] = (bool) $useDefaultThemes;
7472

7573
// Unset instead of resetting to an empty array, in order to allow
7674
// implementations (like TwigRendererEngine) to check whether $cacheKey

src/Symfony/Component/Form/FormRenderer.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,9 @@ public function getEngine()
7070
/**
7171
* {@inheritdoc}
7272
*/
73-
public function setTheme(FormView $view, $themes /*, $useDefaultThemes = true */)
73+
public function setTheme(FormView $view, $themes, $useDefaultThemes = true)
7474
{
75-
$args = func_get_args();
76-
$this->engine->setTheme($view, $themes, isset($args[2]) ? (bool) $args[2] : true);
75+
$this->engine->setTheme($view, $themes, $useDefaultThemes);
7776
}
7877

7978
/**

src/Symfony/Component/Form/FormRendererEngineInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ interface FormRendererEngineInterface
2525
* @param mixed $themes The theme(s). The type of these themes
2626
* is open to the implementation.
2727
* @param bool $useDefaultThemes If true, will use default themes specified
28-
* in the engine, will be added to the interface in 4.0
28+
* in the engine
2929
*/
30-
public function setTheme(FormView $view, $themes /*, $useDefaultThemes = true */);
30+
public function setTheme(FormView $view, $themes, $useDefaultThemes = true);
3131

3232
/**
3333
* Returns the resource for a block name.

src/Symfony/Component/Form/FormRendererInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ public function getEngine();
3232
* @param mixed $themes The theme(s). The type of these themes
3333
* is open to the implementation.
3434
* @param bool $useDefaultThemes If true, will use default themes specified
35-
* in the renderer, will be added to the interface in 4.0
35+
* in the renderer
3636
*/
37-
public function setTheme(FormView $view, $themes /*, $useDefaultThemes = true */);
37+
public function setTheme(FormView $view, $themes, $useDefaultThemes = true);
3838

3939
/**
4040
* Renders a named block of the form theme.

0 commit comments

Comments
 (0)
0