Skip to content

Commit

Permalink
[Form] Fix the FormView::isRendered() method
Browse files Browse the repository at this point in the history
  • Loading branch information
vicb committed Jun 6, 2011
1 parent c2b9061 commit eed54c1
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/Symfony/Component/Form/FormView.php
Expand Up @@ -112,7 +112,21 @@ public function setAttribute($name, $value)
*/
public function isRendered()
{
return $this->rendered;
if (true === $this->rendered || 0 == count($this->children)) {
return $this->rendered;
}

if (count($this->children) > 0) {
foreach ($this->children as $child) {
if (!$child->isRendered()) {
return false;
}
}

return $this->rendered = true;
} else {
return false;
}
}

/**
Expand Down Expand Up @@ -258,10 +272,6 @@ public function offsetUnset($name)
*/
public function getIterator()
{
if (count($this->children)) {
$this->rendered = true;
}

return new \ArrayIterator($this->children);
}

Expand Down

0 comments on commit eed54c1

Please sign in to comment.