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


PHP StringField::__construct方法代码示例

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


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

示例1: __construct

 /**
  * {@inheritdoc}
  */
 public function __construct($name, $default_value = null, $add_index = false)
 {
     parent::__construct($name, $default_value, $add_index);
     if ($default_value !== null) {
         $this->modifier('trim');
     }
 }
开发者ID:activecollab,项目名称:databasestructure,代码行数:10,代码来源:EmailField.php

示例2: __construct

 /**
  * {@inheritdoc}
  */
 public function __construct($name = 'country_code', $default_value = null, $add_index = false)
 {
     parent::__construct($name, $default_value, $add_index);
     if ($default_value !== null) {
         $this->modifier('strtoupper');
     }
     $this->length(2);
 }
开发者ID:activecollab,项目名称:databasestructure,代码行数:11,代码来源:CountryCodeField.php

示例3: __construct

 /**
  * Create a new Enum field.
  *
  * Example usage in {@link DataObject::$db} with comma-separated string
  * notation ('Val1' is default)
  *
  * <code>
  *  "MyField" => "Enum('Val1, Val2, Val3', 'Val1')"
  * </code>
  *
  * Example usage in in {@link DataObject::$db} with array notation
  * ('Val1' is default)
  *
  * <code>
  * "MyField" => "Enum(array('Val1', 'Val2', 'Val3'), 'Val1')"
  * </code>
  *
  * @param enum: A string containing a comma separated list of options or an
  *				array of Vals.
  * @param string The default option, which is either NULL or one of the
  *				 items in the enumeration.
  */
 public function __construct($name = null, $enum = NULL, $default = NULL)
 {
     if ($enum) {
         $this->setEnum($enum);
         // If there's a default, then
         if ($default) {
             if (in_array($default, $this->getEnum())) {
                 $this->setDefault($default);
             } else {
                 user_error("Enum::__construct() The default value '{$default}' does not match any item in the" . " enumeration", E_USER_ERROR);
             }
             // By default, set the default value to the first item
         } else {
             $enum = $this->getEnum();
             $this->setDefault(reset($enum));
         }
     }
     parent::__construct($name);
 }
开发者ID:ivoba,项目名称:silverstripe-framework,代码行数:41,代码来源:Enum.php

示例4: __construct

 /**
  * Create a new Enum field.
  *
  * Example usage in {@link DataObject::$db} with comma-separated string
  * notation ('Val1' is default)
  *
  * <code>
  *  "MyField" => "Enum('Val1, Val2, Val3', 'Val1')"
  * </code>
  *
  * Example usage in in {@link DataObject::$db} with array notation
  * ('Val1' is default)
  *
  * <code>
  * "MyField" => "Enum(array('Val1', 'Val2', 'Val3'), 'Val1')"
  * </code>
  *
  * @param enum: A string containing a comma separated list of options or an
  *				array of Vals.
  * @param string The default option, which is either NULL or one of the
  *				 items in the enumeration.
  */
 public function __construct($name = null, $enum = NULL, $default = NULL)
 {
     if ($enum) {
         if (!is_array($enum)) {
             $enum = preg_split("/\\s*,\\s*/", trim($enum, ", \t\n\r\v"));
         }
         $this->enum = $enum;
         // If there's a default, then
         if ($default) {
             if (in_array($default, $enum)) {
                 $this->default = $default;
             } else {
                 user_error("Enum::__construct() The default value '{$default}' does not match any item in the" . " enumeration", E_USER_ERROR);
             }
             // By default, set the default value to the first item
         } else {
             $this->default = reset($enum);
         }
     }
     parent::__construct($name);
 }
开发者ID:tcaiger,项目名称:mSupplyNZ,代码行数:43,代码来源:Enum.php

示例5: __construct

 /**
  * EmailField constructor.
  */
 public function __construct()
 {
     parent::__construct();
     $this->addValidationRules(['email']);
 }
开发者ID:kalaomer,项目名称:kahire,代码行数:8,代码来源:EmailField.php

示例6: __construct

 public function __construct($name, $object = null)
 {
     $this->object = $object;
     parent::__construct($name);
 }
开发者ID:Cumquat,项目名称:silverstripe-orientdb-poc,代码行数:5,代码来源:OrientForeignKey.php

示例7: __construct

 /**
  * Construct a new short text field
  *
  * @param $name string The name of the field
  * @param $size int The maximum size of the field, in terms of characters
  * @param $options array Optional parameters, e.g. array("nullifyEmpty"=>false).
  *                       See {@link StringField::setOptions()} for information on the available options
  * @return unknown_type
  */
 public function __construct($name = null, $size = 50, $options = array())
 {
     $this->size = $size ? $size : 50;
     parent::__construct($name, $options);
 }
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:14,代码来源:Varchar.php

示例8: array

 function __construct($name, $parameters = array())
 {
     parent::__construct($name, $parameters);
     $this->dataType = $this->fieldType = 'text';
 }
开发者ID:msergeev06,项目名称:mj-msergeev,代码行数:5,代码来源:text_field.php

示例9: __construct

 public function __construct($label, $validators = [], $options = [])
 {
     parent::__construct($label, $validators, $options);
     $this->type = 'password';
 }
开发者ID:b4oshany,项目名称:wtforms-php,代码行数:5,代码来源:PasswordField.php

示例10: __construct

 /**
  * Create a field object.
  * @param string $label - Label for the field.
  * @uses WTForms\Widgets\TextAreaWidget
  */
 public function __construct($label, $validators = [], $options = [])
 {
     parent::__construct($label, $validators, $options);
     $this->widget = new TextAreaWidget();
     $this->type = 'textarea';
 }
开发者ID:b4oshany,项目名称:wtforms-php,代码行数:11,代码来源:TextAreaField.php

示例11:

 function __construct(array $args)
 {
     parent::__construct($args);
     $this->type = 'hidden';
 }
开发者ID:highlands-framework,项目名称:highlands-framework,代码行数:5,代码来源:HiddenField.php


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