Skip to content

Commit eed54c1

Browse files
committed
[Form] Fix the FormView::isRendered() method
1 parent c2b9061 commit eed54c1

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/Symfony/Component/Form/FormView.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,21 @@ public function setAttribute($name, $value)
112112
*/
113113
public function isRendered()
114114
{
115-
return $this->rendered;
115+
if (true === $this->rendered || 0 == count($this->children)) {
116+
return $this->rendered;
117+
}
118+
119+
if (count($this->children) > 0) {
120+
foreach ($this->children as $child) {
121+
if (!$child->isRendered()) {
122+
return false;
123+
}
124+
}
125+
126+
return $this->rendered = true;
127+
} else {
128+
return false;
129+
}
116130
}
117131

118132
/**
@@ -258,10 +272,6 @@ public function offsetUnset($name)
258272
*/
259273
public function getIterator()
260274
{
261-
if (count($this->children)) {
262-
$this->rendered = true;
263-
}
264-
265275
return new \ArrayIterator($this->children);
266276
}
267277

0 commit comments

Comments
 (0)