Ejemplo n.º 1
0
 /**
  * Builds a control according to the $type (input, select, radios, etc.)
  *
  * @param string $type
  * @param string $name
  * @param mixed $value
  * @param array $attributes
  * @param array|null $options
  * @param string $htmlName
  *
  * @return string
  */
 protected function buildControl($type, $name, $value, $attributes, $options, $htmlName)
 {
     switch ($type) {
         case 'password':
         case 'file':
             return $this->form->{$type}($htmlName, $attributes);
         case 'select':
             return $this->form->{$type}($htmlName, $this->addEmptyOption($name, $this->getOptionsList($name, $options), $attributes), $value, $attributes);
         case 'radios':
         case 'checkboxes':
             return $this->form->{$type}($htmlName, $this->getOptionsList($name, $options), $value, $attributes);
         case 'checkbox':
             return $this->form->checkbox($htmlName, $options ?: 1, $value, $attributes);
         default:
             return $this->form->{$type}($htmlName, $value, $attributes);
     }
 }
Ejemplo n.º 2
0
 /**
  * Register the Form Builder instance.
  */
 protected function registerFormBuilder()
 {
     $this->app['form'] = $this->app->share(function ($app) {
         $this->loadConfigurationOptions();
         $form = new FormBuilder($app['html'], $app['url'], $app['session.store']->getToken(), $this->getTheme());
         $form->novalidate($app['config']->get('html.novalidate', false));
         return $form->setSessionStore($app['session.store']);
     });
 }
Ejemplo n.º 3
0
 /**
  * Checks if macro is registered.
  *
  * @param string $name
  * @return bool 
  * @static 
  */
 public static function hasMacro($name)
 {
     //Method inherited from \Collective\Html\FormBuilder
     return \Styde\Html\FormBuilder::hasMacro($name);
 }