Beispiel #1
0
 /**
  * @param FormInterface $form
  * @param integer       $countBegin
  * @return void
  */
 protected function suffixFormFields(FormInterface $form, $countBegin = 0)
 {
     foreach ($form->getWritableBearer()->getWritables() as $writable) {
         if ($writable instanceof FieldInterface) {
             $writable->addSuffix(0);
         }
     }
     $count = 1;
     foreach ($form->getWritableBearer()->getWritables() as $writable) {
         if ($writable instanceof FormInterface) {
             $this->suffixFormFieldsFixed($writable, $count);
             $this->suffixFormFields($writable);
             $count++;
         }
     }
     $this->suffixFieldBearerFields($form->getWritableBearer());
 }
Beispiel #2
0
 /**
  * Render FormInterface into html.
  *
  * This method is generally called via double-dispatch, as provided by Visitor\VisitableTrait.
  *
  * @param FormInterface $form
  * @return string
  */
 public function visitForm(FormInterface $form)
 {
     $template = "form/{$form->getType()}.twig";
     return $this->loadTemplate($template)->render(["id" => $form->getId(), "classes" => $form->getClasses(), "data" => $form->getData(), "method" => $form->getMethod(), "target" => $form->getTarget(), "writables" => $form->getWritableBearer()->getWritables(), "actions" => $form->getActions(), "errors" => $form->getErrors()]);
 }