/**
  * Set up a single child element for a collection
  *
  * @param FormField $field
  * @param           $name
  * @param null      $value
  * @return FormField
  */
 protected function setupChild(FormField $field, $name, $value = null)
 {
     $newFieldName = $field->getName() . $name;
     $firstFieldOptions = $this->formHelper->mergeOptions($this->getOption('options'), array('attr' => array('id' => $newFieldName)));
     $field->setName($newFieldName);
     $field->setOptions($firstFieldOptions);
     if ($value && !$field instanceof ChildFormType) {
         $value = $this->getModelValueAttribute($value, $this->getOption('property'));
     }
     $field->setValue($value, true);
     return $field;
 }
 /**
  * @inheritdoc
  */
 public function isRendered()
 {
     foreach ($this->children as $key => $child) {
         if ($child->isRendered()) {
             return true;
         }
     }
     return parent::isRendered();
 }
 function form_errors(FormField $formField, array $options = array())
 {
     return $formField->render($options, false, false, true);
 }