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


PHP Formo::args方法代码示例

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


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

示例1: __construct

 /**
  * Create a new field
  * 
  * @access public
  * @param mixed $alias
  * @param mixed $driver. (default: NULL)
  * @param mixed array $options. (default: NULL)
  * @return void
  */
 public function __construct($alias, $driver = NULL, $value = NULL, array $options = NULL)
 {
     $options = func_get_args();
     $orig_options = $options;
     $options = Formo::args(__CLASS__, __FUNCTION__, $options);
     // Add all the options to the object
     $this->load_options($options);
     // Run the driver's post_construct() method
     $this->driver()->post_construct();
 }
开发者ID:justus,项目名称:kohana-formo,代码行数:19,代码来源:core.php

示例2: __construct

 /**
  * Create a new field
  *
  * @access public
  * @param mixed $alias
  * @param mixed $driver. (default: NULL)
  * @param mixed array $options. (default: NULL)
  * @return void
  */
 public function __construct($alias, $driver = NULL, $value = NULL, array $options = NULL)
 {
     $options = func_get_args();
     $orig_options = $options;
     $options = Formo::args(__CLASS__, __FUNCTION__, $options);
     // Always process the driver first
     $driver = $options['driver'];
     unset($options['driver']);
     $options = Arr::merge(array('driver' => $driver), $options);
     // Add all the options to the object
     $this->_load_options($options);
     // Run the driver's post_construct() method
     $this->driver()->post_construct();
 }
开发者ID:kanikaN,项目名称:qload,代码行数:23,代码来源:field.php

示例3: 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

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