當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。