Esempio 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);
     }
 }
Esempio n. 2
0
 /**
  * Create a checkbox input field.
  *
  * @param string $name
  * @param mixed $value
  * @param bool $checked
  * @param array $options
  * @return string 
  * @static 
  */
 public static function checkbox($name, $value = 1, $checked = null, $options = array())
 {
     //Method inherited from \Collective\Html\FormBuilder
     return \Styde\Html\FormBuilder::checkbox($name, $value, $checked, $options);
 }