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


PHP OptionsetField::__construct方法代码示例

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


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

示例1: __construct

 /**
  * Construct the field
  *
  * @param string $name
  * @param null|string $title
  * @param string $sourceFolder
  **/
 public function __construct($name, $title = null, $sourceFolder = '/site/icons/')
 {
     parent::__construct($name, $title, null);
     $sourcePath = BASE_PATH . $sourceFolder;
     // image extensions
     $extensions = array('jpg', 'jpeg', 'png', 'gif', 'bmp', 'svg');
     // init result
     $icons = array();
     // directory to scan
     $directory = new DirectoryIterator($sourcePath);
     // iterate
     foreach ($directory as $fileinfo) {
         // must be a file
         if ($fileinfo->isFile()) {
             // file extension
             $extension = strtolower(pathinfo($fileinfo->getFilename(), PATHINFO_EXTENSION));
             // check if extension match
             if (in_array($extension, $extensions)) {
                 $icons[$sourceFolder . $fileinfo->getFilename()] = $fileinfo->getFilename();
             }
         }
     }
     $this->source = $icons;
     Requirements::css(DEVTOOLS_DIR . '/css/IconSelectField.css');
     Requirements::javascript(DEVTOOLS_DIR . '/js/IconSelectField.js');
 }
开发者ID:jaedb,项目名称:dev-tools,代码行数:33,代码来源:IconSelectField.php

示例2: __construct

 public function __construct($name, $title = null, $source = array(), $value = '', $form = null, $emptyString = null)
 {
     if (empty($source)) {
         $source = array(self::VALUE_YES => _t('YesNoOptionsetField.YES', 'Yes'), self::VALUE_NO => _t('YesNoOptionsetField.NO', 'No'));
     }
     parent::__construct($name, $title, $source, $value, $form, $emptyString);
 }
开发者ID:lekoala,项目名称:silverstripe-form-extras,代码行数:7,代码来源:YesNoOptionsetField.php

示例3: array

 function __construct($name, $title = '', $options = array(), $value = '', $folderID)
 {
     $this->setOptions($options);
     $this->setFolderID($folderID);
     $this->createObjects();
     parent::__construct($name, $title, $options, $value);
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce-product-questions,代码行数:7,代码来源:ProductQuestionImageSelectorField.php

示例4: array

 /**
  * Creates a new optionset field.
  * @param name The field name
  * @param title The field title
  * @param source DataObjectSet
  * @param value The current value
  * @param form The parent form
  */
 function __construct($name, $title = "", $addresses = null, $value = "", $form = null)
 {
     $this->addresses = $addresses;
     $source = array();
     if ($this->addresses) {
         $source = $this->addresses->map("ID", "FullString");
     }
     parent::__construct($name, $title, $source, $value, $form);
 }
开发者ID:nieku,项目名称:silverstripe-ecommerce,代码行数:17,代码来源:SelectOrderAddressField.php

示例5: array

 function __construct($name, $title = '', $value = '', $objects, $imageFieldName = "Image", $width = 32, $height = 16)
 {
     $array = array();
     if ($objects) {
         $array = $objects->toDropDownMap();
         $this->objects = $objects;
     }
     $this->imageFieldName = $imageFieldName;
     $this->width = $width;
     $this->height = $height;
     parent::__construct($name, $title, $array, $value);
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-form-fields,代码行数:12,代码来源:ImageOptionsetField.php

示例6: array

 /**
  * Creates a new optionset field.
  * @param String $name The field name
  * @param String $title The field title
  * @param ArrayList $addresses
  * @param String $value The current value
  * @param Form $form - The parent form
  */
 function __construct($name, $title = "", $addresses = null, $value = "", Form $form = null)
 {
     $this->addresses = $addresses;
     $source = array();
     if ($this->addresses && $this->addresses instanceof ArrayList) {
         $source = array();
         foreach ($this->addresses as $address) {
             $source[$address->ID] = $address->FullString();
         }
     }
     parent::__construct($name, $title, $source, $value, $form);
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce,代码行数:20,代码来源:SelectOrderAddressField.php

示例7: __construct

 public function __construct(DataObject $controller, $name, $title = null, $className = null, $source = array(), $addTitle = null, $defaultsProperties = array(), $form = null)
 {
     $hasOne = false;
     if (!$title) {
         $this->title = self::name_to_label($name);
     }
     if (!$className) {
         if (substr($name, -2) == 'ID') {
             $name = substr($name, 0, -2);
         }
         if (!($hasOne = $className = $controller->has_one($name)) && !($className = $controller->belongs_to($name)) && (($settings = $controller->has_many($name)) || ($settings = $controller->many_many($name)))) {
             if (is_array($settings)) {
                 $className = $settings[1];
             } else {
                 $className = $settings;
             }
             $this->fieldType = 'CheckboxSetField';
         }
         if (!$className) {
             trigger_error('Couldn\'t determine class type from field name "' . $name . '". Please define the class name.');
         }
         if ($hasOne) {
             $name .= 'ID';
         }
     } else {
         if ($rels = $controller->has_many() + $controller->many_many()) {
             foreach ($rels as $rel => $class) {
                 if ($class == $className || ClassInfo::is_subclass_of($class, $className)) {
                     $this->fieldType = 'CheckboxSetField';
                     break;
                 }
             }
         }
     }
     if (!class_exists($className)) {
         trigger_error($className . ' class doesn\'t exist');
     }
     $this->setDefaults($defaultsProperties);
     $this->className = $className;
     $this->controller = $controller;
     parent::__construct($name, $title, $source, null, $form);
 }
开发者ID:betterbrief,项目名称:silverstripe-quickaddfield,代码行数:42,代码来源:QuickAddField.php

示例8: __construct

 /**
  * Constructor
  *
  * @param string $name The field name
  * @param string $title The field title
  * @param array $source An map of the dropdown items
  * @param string $value The current value
  * @param Form $form The parent form
  */
 public function __construct($name, $title = null, $source = array(), $value = '', $form = null)
 {
     parent::__construct($name, $title, $source, $value, $form);
     $this->addExtraClass('optionset');
 }
开发者ID:antonythorpe,项目名称:silverstripe-knockout-forms,代码行数:14,代码来源:KnockoutOptionsetField.php

示例9: array

 function __construct($name, $title = "", $source = array(), $value = "", $form = null)
 {
     parent::__construct($name, $title, $source, $value, $form);
     Requirements::css('sapphire/css/CheckboxSetField.css');
 }
开发者ID:ramziammar,项目名称:websites,代码行数:5,代码来源:CheckboxSetField.php

示例10: __construct

 public function __construct($name, $title = null, $source = array(), $value = '', $form = null, $emptyString = null, IMultiValueQuestionTemplate $question)
 {
     parent::__construct($name, $title, $source, $value, $form, $emptyString);
     $this->question = $question;
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:5,代码来源:SurveyRankingField.php

示例11: __construct

 /**
  * ImageOptionsetField constructor.
  * @param string $name
  * @param null|string $title
  * @param array|ArrayAccess $source
  * @param string $value
  * @param Form|null $form
  * @param null $emptyString
  */
 public function __construct($name, $title = null, $source = array(), $value = '', $form = null, $emptyString = null)
 {
     $this->imageWidth = $this->config()->default_image_width;
     $this->imageHeight = $this->config()->default_image_height;
     parent::__construct($name, $title, $source, $value, $form, $emptyString);
 }
开发者ID:unclecheese,项目名称:silverstripe-image-optionset,代码行数:15,代码来源:ImageOptionsetField.php


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