当前位置: 首页>>代码示例>>PHP>>正文


PHP Formo::field方法代码示例

本文整理汇总了PHP中Formo::field方法的典型用法代码示例。如果您正苦于以下问题:PHP Formo::field方法的具体用法?PHP Formo::field怎么用?PHP Formo::field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Formo的用法示例。


在下文中一共展示了Formo::field方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: html

 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());
 }
开发者ID:justus,项目名称:kohana-formo,代码行数:7,代码来源:core.php

示例2: html

	public function html()
	{
		foreach ($this->_field->get('options') as $label => $options)
		{
			$this->_field->append(Formo::field($label, 'radio', $options));
		}
	}
开发者ID:refo,项目名称:kohana,代码行数:7,代码来源:radios.php

示例3: html

 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());
 }
开发者ID:kanikaN,项目名称:qload,代码行数:7,代码来源:optgroup.php

示例4: html

	public function html()
	{
		foreach ($this->_field->get('options') as $alias => $options)
		{
			$this->_field->append(Formo::field($alias, 'checkbox', $options));
		}
	}
开发者ID:refo,项目名称:kohana,代码行数:7,代码来源:checkboxes.php

示例5: html

 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());
 }
开发者ID:salesignighter,项目名称:kohana-formo,代码行数:8,代码来源:core.php

示例6: add

 /**
  * 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;
 }
开发者ID:justus,项目名称:kohana-formo,代码行数:56,代码来源:core.php

示例7: add

 /**
  * 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;
 }
开发者ID:kanikaN,项目名称:qload,代码行数:34,代码来源:form.php


注:本文中的Formo::field方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。