public function buildViewBottomUp(FormView $view, FormInterface $form)
 {
     foreach ($view->getChildren() as $child) {
         /* @var \Symfony\Component\Form\FormView $child */
         $child->set('full_name', $child->get('name'));
     }
 }
예제 #2
0
 public function buildViewBottomUp(FormView $view, FormInterface $form)
 {
     $multipart = false;
     foreach ($view->getChildren() as $child) {
         if ($child->get('multipart')) {
             $multipart = true;
             break;
         }
     }
     $view->set('multipart', $multipart);
 }
예제 #3
0
 /**
  * {@inheritdoc}
  */
 public function buildViewBottomUp(FormView $view, FormInterface $form)
 {
     if ($view->get('expanded')) {
         // Radio buttons should have the same name as the parent
         $childName = $view->get('full_name');
         // Checkboxes should append "[]" to allow multiple selection
         if ($view->get('multiple')) {
             $childName .= '[]';
         }
         foreach ($view->getChildren() as $childView) {
             $childView->set('full_name', $childName);
         }
     }
 }
예제 #4
0
 private function collectErrors(FormView $form, &$errors)
 {
     if ($form->get('errors')) {
         $errors[] = $form;
     }
     foreach ($form->getChildren() as $child) {
         $this->collectErrors($child, $errors);
     }
 }
예제 #5
0
 protected function renderFormRest(FormView $view, $blockName, array $variables = array())
 {
     $renderedView = array();
     // TODO, here add the rendered views to a form object, or something
     foreach ($view->getChildren() as $childView) {
         $renderedView[] = $this->renderBlock($childView, 'row');
     }
     return $renderedView;
 }
 /**
  * @param FormView $form A form.
  * @return boolean If the form (taking into account all of its children) has errors.
  */
 public function hasFormDeepErrors(FormView $form)
 {
     if (count($form->get('errors')) > 0) {
         return true;
     }
     foreach ($form->getChildren() as $child) {
         if ($this->hasFormDeepErrors($child)) {
             return true;
         }
     }
     return false;
 }