Ejemplo n.º 1
0
 public function html()
 {
     foreach ($this->field->get('options') as $label => $options) {
         $this->field->append(Formo::field($label, 'option', $options));
     }
     $this->decorator->set('tag', 'select')->attr('name', $this->name());
 }
Ejemplo n.º 2
0
	public function html()
	{
		foreach ($this->_field->get('options') as $label => $options)
		{
			$this->_field->append(Formo::field($label, 'radio', $options));
		}
	}
Ejemplo n.º 3
0
 public function html()
 {
     foreach ($this->_field->get('options') as $label => $options) {
         $this->_field->append(Formo::field($label, 'option', $options));
     }
     $this->_view->set_var('tag', 'optgroup')->attr('label', $this->_field->alias());
 }
Ejemplo n.º 4
0
	public function html()
	{
		foreach ($this->_field->get('options') as $alias => $options)
		{
			$this->_field->append(Formo::field($alias, 'checkbox', $options));
		}
	}
Ejemplo n.º 5
0
 public function html()
 {
     $this->render_field->append(Formo::field('', 'option'));
     foreach ($this->render_field->options as $label => $options) {
         $this->render_field->append(Formo::field($label, 'option', $options));
     }
     $this->render_field->set('tag', 'select')->attr('name', $this->field->alias());
 }
Ejemplo n.º 6
0
 /**
  * Adds a field to a form
  *
  * @access public
  * @param mixed $alias
  * @param mixed $driver. (default: NULL)
  * @param mixed $value. (default: NULL)
  * @param mixed array $options. (default: NULL)
  * @return object
  */
 public function add($alias, $driver = NULL, $value = NULL, array $options = NULL)
 {
     // If Formo instnace was passed
     if ($alias instanceof Formo_Form) {
         return $this->add_object($alias);
     }
     if ($driver instanceof Formo_Form) {
         return $this->add_object($driver->alias($alias));
     }
     if ($value instanceof Formo_Form) {
         return $this->add_object($value->set('driver', $driver)->alias($alias));
     }
     $orig_options = $options;
     $options = func_get_args();
     $options = Formo::args(__CLASS__, __FUNCTION__, $options);
     // If a driver is named but not an alias, make the driver text and the alias the driver
     if (empty($options['driver'])) {
         $options['driver'] = Arr::get($this->config, 'default_driver', 'text');
     }
     // Allow loading rules, callbacks, filters upon adding a field
     $validate_options = array('rules', 'triggers', 'filters');
     // Create the array
     $validate_settings = array();
     foreach ($validate_options as $option) {
         if (!empty($options[$option])) {
             $validate_settings[$option] = $options[$option];
             unset($options[$option]);
         }
     }
     // Create the new field
     $field = Formo::field($options);
     $this->append($field);
     // Add the validation rules
     foreach ($validate_settings as $method => $array) {
         foreach ($array as $callback => $opts) {
             if ($opts instanceof Formo_Validator_Item) {
                 // The rules method will suffice for all Formo_Validator_Item objects
                 $field->rules(NULL, $opts);
                 continue;
             }
             $args = array(NULL, $callback, $opts);
             call_user_func_array(array($field, $method), $args);
         }
     }
     return $this;
 }
Ejemplo n.º 7
0
 /**
  * Adds a field to a form
  *
  * @access public
  * @param mixed $alias
  * @param mixed $driver. (default: NULL)
  * @param mixed $value. (default: NULL)
  * @param mixed array $options. (default: NULL)
  * @return object
  */
 public function add($alias, $driver = NULL, $value = NULL, array $options = NULL)
 {
     // If Formo instnace was passed
     if ($alias instanceof Formo_Form) {
         return $this->_add_object($alias);
     }
     if ($driver instanceof Formo_Form) {
         return $this->_add_object($driver->alias($alias));
     }
     if ($value instanceof Formo_Form) {
         return $this->_add_object($value->set('driver', $driver)->alias($alias));
     }
     $orig_options = $options;
     $options = func_get_args();
     $options = Formo::args(__CLASS__, __FUNCTION__, $options);
     // If a driver is named but not an alias, make the driver text and the alias the driver
     if (empty($options['driver'])) {
         $options['driver'] = ($driver = Formo::config($this, 'default_driver')) ? $driver : 'input';
     }
     // Create the new field
     $field = Formo::field($options);
     $this->append($field);
     return $this;
 }
Ejemplo n.º 8
0
 public function html()
 {
     foreach ($this->render_field->options as $alias => $options) {
         $this->render_field->append(Formo::field($alias, 'checkbox', $options));
     }
 }
Ejemplo n.º 9
0
 public function html()
 {
     foreach ($this->render_field->options as $label => $options) {
         $this->render_field->append(Formo::field($label, 'radio', $options));
     }
 }