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


PHP Fieldset::factory方法代码示例

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


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

示例1: set_fields

 /**
  * Set a Model's properties as fields on a Fieldset, which will be created with the Model's
  * classname if none is provided.
  *
  * @param   string
  * @param   Fieldset|null
  * @return  Fieldset
  */
 public static function set_fields($class, $fieldset = null)
 {
     $properties = $class::properties();
     if (is_null($fieldset)) {
         $fieldset = \Fieldset::instance($class);
         if (!$fieldset) {
             $fieldset = \Fieldset::factory($class);
         }
     }
     foreach ($properties as $p => $settings) {
         $field = $fieldset->add($p, !empty($settings['label']) ? $settings['label'] : $p);
         if (empty($settings['validation'])) {
             continue;
         } else {
             foreach ($settings['validation'] as $rule => $args) {
                 if (is_int($rule) and is_string($args)) {
                     $args = array($args);
                 } else {
                     array_unshift($args, $rule);
                 }
                 call_user_func_array(array($field, 'add_rule'), $args);
             }
         }
     }
     return $fieldset;
 }
开发者ID:bryanheo,项目名称:FuelPHP-Auth-AJAX,代码行数:34,代码来源:validation.php

示例2: set_fields

 /**
  * Set a Model's properties as fields on a Fieldset, which will be created with the Model's
  * classname if none is provided.
  *
  * @param   string
  * @param   Fieldset|null
  * @return  Fieldset
  */
 public static function set_fields($obj, $fieldset = null)
 {
     static $_generated = array();
     $class = is_object($obj) ? get_class($obj) : $obj;
     if (is_null($fieldset)) {
         $fieldset = \Fieldset::instance($class);
         if (!$fieldset) {
             $fieldset = \Fieldset::factory($class);
         }
     }
     !array_key_exists($class, $_generated) and $_generated[$class] = array();
     if (in_array($fieldset, $_generated[$class], true)) {
         return $fieldset;
     }
     $_generated[$class][] = $fieldset;
     $fieldset->validation()->add_callable($obj);
     $properties = is_object($obj) ? $obj->properties() : $class::properties();
     foreach ($properties as $p => $settings) {
         $field = $fieldset->add($p, !empty($settings['label']) ? $settings['label'] : $p);
         if (empty($settings['validation'])) {
             continue;
         } else {
             foreach ($settings['validation'] as $rule => $args) {
                 if (is_int($rule) and is_string($args)) {
                     $args = array($args);
                 } else {
                     array_unshift($args, $rule);
                 }
                 call_user_func_array(array($field, 'add_rule'), $args);
             }
         }
     }
     return $fieldset;
 }
开发者ID:469306621,项目名称:Languages,代码行数:42,代码来源:validation.php

示例3: __construct

 protected function __construct($fieldset)
 {
     if (!$fieldset instanceof Fieldset) {
         $fieldset = Fieldset::factory($fieldset, array('validation_instance' => $this));
     }
     $this->fieldset = $fieldset;
     $this->callables = array($this);
 }
开发者ID:netspencer,项目名称:fuel,代码行数:8,代码来源:validation.php

示例4: factory

	public static function factory($fieldset)
	{
		if ( ! $fieldset instanceof Fieldset)
		{
			$fieldset = (string) $fieldset;
			if ( ! ($fieldset = \Fieldset::instance($fieldset)))
			{
				$fieldset = \Fieldset::factory($fieldset);
			}
		}
		return new Validation($fieldset);
	}
开发者ID:nasumi,项目名称:fuel,代码行数:12,代码来源:validation.php

示例5: factory

	public static function factory($fieldset, $config)
	{
		if ( ! $fieldset instanceof Fieldset)
		{
			$fieldset = (string) $fieldset;
			if ( ! ($fieldset = \Fieldset::instance($fieldset)))
			{
				$fieldset = \Fieldset::factory($fieldset, $config);
			}
		}
		return new Form($fieldset);
	}
开发者ID:nasumi,项目名称:fuel,代码行数:12,代码来源:form.php

示例6: __construct

 protected function __construct($fieldset, array $config = array())
 {
     if ($fieldset instanceof Fieldset) {
         $fieldset->form($this);
         $this->fieldset = $fieldset;
     } else {
         $this->fieldset = \Fieldset::factory($fieldset, array('form_instance' => $this));
     }
     foreach ($config as $key => $val) {
         $this->set_config($key, $val);
     }
 }
开发者ID:469306621,项目名称:Languages,代码行数:12,代码来源:form.php


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