Ejemplo n.º 1
0
 /**
  * Make form and controls compatible with Twitter Bootstrap
  * @param Form $form
  */
 protected function prepareForm(Form $form)
 {
     $form->getElementPrototype()->class[] = 'form-horizontal';
     $translator = $form->getTranslator();
     foreach ($form->controls as $control) {
         /** @var BaseControl $control */
         if ($control instanceof HiddenField) {
             continue;
         } elseif ($control instanceof Button) {
             $control->controlPrototype->class[] = "btn-block btn-lg";
         } else {
             if ($control->getLabel()) {
                 $control->setAttribute('placeholder', $control->caption);
                 if (empty($control->controlPrototype->attrs['title'])) {
                     $control->setAttribute('title', $translator ? $translator->translate($control->caption) : $control->caption);
                 }
                 $control->getLabelPrototype()->attrs["style"] = "display:none";
             }
         }
     }
     BootstrapHelper::ApplyBootstrapToControls($form);
 }
Ejemplo n.º 2
0
 /**
  * Make form and controls compatible with Twitter Bootstrap
  * @param Form $form
  */
 protected function prepareForm(Form $form)
 {
     $form->getElementPrototype()->class[] = 'form-inline';
     BootstrapHelper::ApplyBootstrapToControls($form);
 }