Example #1
0
 function form(Form\Form\Form $form)
 {
     $html = '';
     $form->addAttribute('role', 'form');
     $form->addClass('form-horizontal');
     // Elements
     if ($form->hasCsrfToken()) {
         $html .= csrf_field();
     }
     if ($form->hasLegend()) {
         $html .= html('h4', ['class' => Style::MODAL_HEADER_TITLE_CLASS], $form->getLegend());
     }
     $html = html('div', ['class' => Style::MODAL_HEADER_CLASS], $html);
     $body = '';
     foreach ($form->getElements() as $e) {
         /** @var $e \FrenchFrogs\Form\Element\Element */
         $body .= $e->render();
     }
     // body
     $html .= html('div', ['class' => Style::MODAL_BODY_CLASS . ' form-body'], $body);
     // Actions
     if ($form->hasActions()) {
         $actions = '';
         foreach ($form->getActions() as $e) {
             $actions .= $e->render();
         }
         $html .= html('div', ['class' => Style::MODAL_FOOTER_CLASS], $actions);
     }
     if ($form->isRemote()) {
         $form->addClass('form-remote');
     }
     $html = html('form', $form->getAttributes(), $html);
     return $html;
 }
Example #2
0
 function form(Form\Form\Form $form)
 {
     $html = '';
     $form->addAttribute('role', 'form');
     // Elements
     if ($form->hasCsrfToken()) {
         $html .= csrf_field();
     }
     foreach ($form->getElements() as $e) {
         /** @var $e \FrenchFrogs\Form\Element\Element */
         $html .= $e->render();
     }
     // Actions
     if ($form->hasActions()) {
         $html .= '<div class="text-right">';
         foreach ($form->getActions() as $e) {
             $html .= $e->render();
         }
         $html .= "</div>";
     }
     if ($form->isRemote()) {
         $form->addClass('form-remote');
     } elseif ($form->isCallback()) {
         $form->addClass('form-callback');
     }
     $form->addCLass('form-horizontal');
     $html = html('form', $form->getAttributes(), $html);
     if ($form->hasPanel()) {
         $html = $form->getPanel()->setBody($html)->render();
     }
     return $html;
 }