merged branch eriksencosta/cs-fixes (PR #3816)
Commits -------abd59c3
Merge branch 'master' into cs-fixesf5f0506
[TwigBundle] fixed CS Discussion ---------- CS fixes
This commit is contained in:
commit
0a585b7130
@ -216,9 +216,9 @@ class FormExtension extends \Twig_Extension
|
|||||||
protected function render(FormView $view, $section, array $variables = array())
|
protected function render(FormView $view, $section, array $variables = array())
|
||||||
{
|
{
|
||||||
$mainTemplate = in_array($section, array('widget', 'row'));
|
$mainTemplate = in_array($section, array('widget', 'row'));
|
||||||
if ($mainTemplate && $view->isRendered()) {
|
|
||||||
|
|
||||||
return '';
|
if ($mainTemplate && $view->isRendered()) {
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $this->template) {
|
if (null === $this->template) {
|
||||||
@ -240,7 +240,7 @@ class FormExtension extends \Twig_Extension
|
|||||||
$types = $view->get('types');
|
$types = $view->get('types');
|
||||||
$types[] = $custom;
|
$types[] = $custom;
|
||||||
$typeIndex = count($types) - 1;
|
$typeIndex = count($types) - 1;
|
||||||
$this->varStack[$rendering] = array (
|
$this->varStack[$rendering] = array(
|
||||||
'variables' => array_replace_recursive($view->all(), $variables),
|
'variables' => array_replace_recursive($view->all(), $variables),
|
||||||
'types' => $types,
|
'types' => $types,
|
||||||
);
|
);
|
||||||
@ -250,7 +250,6 @@ class FormExtension extends \Twig_Extension
|
|||||||
$types[$typeIndex] .= '_'.$section;
|
$types[$typeIndex] .= '_'.$section;
|
||||||
|
|
||||||
if (isset($blocks[$types[$typeIndex]])) {
|
if (isset($blocks[$types[$typeIndex]])) {
|
||||||
|
|
||||||
$this->varStack[$rendering]['typeIndex'] = $typeIndex;
|
$this->varStack[$rendering]['typeIndex'] = $typeIndex;
|
||||||
|
|
||||||
// we do not call renderBlock here to avoid too many nested level calls (XDebug limits the level to 100 by default)
|
// we do not call renderBlock here to avoid too many nested level calls (XDebug limits the level to 100 by default)
|
||||||
@ -331,7 +330,6 @@ class FormExtension extends \Twig_Extension
|
|||||||
protected function getBlocks(FormView $view)
|
protected function getBlocks(FormView $view)
|
||||||
{
|
{
|
||||||
if (!$this->blocks->contains($view)) {
|
if (!$this->blocks->contains($view)) {
|
||||||
|
|
||||||
$rootView = !$view->hasParent();
|
$rootView = !$view->hasParent();
|
||||||
|
|
||||||
$templates = $rootView ? $this->resources : array();
|
$templates = $rootView ? $this->resources : array();
|
||||||
@ -346,6 +344,7 @@ class FormExtension extends \Twig_Extension
|
|||||||
if (!$template instanceof \Twig_Template) {
|
if (!$template instanceof \Twig_Template) {
|
||||||
$template = $this->environment->loadTemplate($template);
|
$template = $this->environment->loadTemplate($template);
|
||||||
}
|
}
|
||||||
|
|
||||||
$templateBlocks = array();
|
$templateBlocks = array();
|
||||||
do {
|
do {
|
||||||
$templateBlocks = array_merge($template->getBlocks(), $templateBlocks);
|
$templateBlocks = array_merge($template->getBlocks(), $templateBlocks);
|
||||||
|
Reference in New Issue
Block a user