Skip to content

Commit

Permalink
fixed form field groups rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
Herzult authored and fabpot committed Oct 18, 2010
1 parent 5b6d92d commit 56d9830
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Expand Up @@ -123,7 +123,7 @@ protected function wrapFields($fields)

protected function createField(FormFieldInterface $field)
{
if ($field instanceof Form || get_class($field) === 'Symfony\Component\Form\FieldGroup') {
if ($field instanceof FieldGroupInterface && !$field instanceof HybridField) {
return new FieldGroup($field, $this->engine, $this->generator, $this->theme, $this->doctype);
}

Expand Down
7 changes: 5 additions & 2 deletions src/Symfony/Bundle/FrameworkBundle/Templating/Form/Field.php
Expand Up @@ -2,6 +2,9 @@

namespace Symfony\Bundle\FrameworkBundle\Templating\Form;

use Symfony\Component\Form\FieldGroupInterface;
use Symfony\Component\Form\HybridField;

/*
* This file is part of the Symfony framework.
*
Expand All @@ -22,7 +25,7 @@ class Field extends BaseField

public function render($template = null)
{
if ($this->field instanceof Form || get_class($this->field) === 'Symfony\Component\Form\FieldGroup') {
if ($this->field instanceof FieldGroupInterface && !$this->field instanceof HybridField) {
throw new \LogicException(sprintf('Cannot render a group field as a row (%s)', $this->field->getKey()));
}

Expand All @@ -40,7 +43,7 @@ public function data()

public function widget(array $attributes = array(), $template = null)
{
if ($this->field instanceof Form || get_class($this->field) === 'Symfony\Component\Form\FieldGroup') {
if ($this->field instanceof FieldGroupInterface && !$this->field instanceof HybridField) {
throw new \LogicException(sprintf('Cannot render a group field (%s)', $this->field->getKey()));
}

Expand Down

0 comments on commit 56d9830

Please sign in to comment.