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


PHP FormField::__construct方法代码示例

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


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

示例1:

 /**
  * Create a new tree dropdown field.
  * @param name The name of the field.
  * @param title The label of the field.
  * @param sourceObject The object-type to list in the tree.  Must be a 'hierachy' object.
  * @param keyField The column of that object-type to return as the field value.  Defaults to ID
  * @param labelField The column to show as the human-readable value in the tree.  Defaults to Title
  */
 function __construct($name, $title, $sourceObject = "Group", $keyField = "ID", $labelField = "Title")
 {
     $this->sourceObject = $sourceObject;
     $this->keyField = $keyField;
     $this->labelField = $labelField;
     parent::__construct($name, $title);
 }
开发者ID:racontemoi,项目名称:shibuichi,代码行数:15,代码来源:TreeDropdownField.php

示例2: __construct

 /**
  * Create a new textarea field.
  * 
  * @param $name Field name
  * @param $title Field title
  * @param $value The current value
  */
 public function __construct($name, $title = null, $value = '')
 {
     if (count(func_get_args()) > 3) {
         Deprecation::notice('3.0', 'Use setRows() and setColumns() instead of constructor arguments');
     }
     parent::__construct($name, $title, $value);
 }
开发者ID:normann,项目名称:sapphire,代码行数:14,代码来源:TextareaField.php

示例3: __construct

 /**
  * Constructor
  * 
  * @param string  $name      Name of the field
  * @param string  $title     Title of the field
  * @param SS_List $dataList  DataList to use
  * @param array   $fieldList List of fields to use
  * 
  * @return void
  *
  * @author Sebastian Diel <sdiel@pixeltricks.de>
  * @since 22.03.2013
  */
 public function __construct($name, $title, SS_List $dataList, $fieldList = null)
 {
     parent::__construct($name, $title);
     $this->setTemplate('SilvercartTableField');
     $this->setDataList($dataList);
     $this->setFieldList($fieldList ? $fieldList : singleton($dataList->dataClass())->summaryFields());
 }
开发者ID:silvercart,项目名称:silvercart,代码行数:20,代码来源:SilvercartTableField.php

示例4: __construct

 public function __construct($name, $title = null, $value = '', $extension = null, $areaCode = null, $countryCode = null)
 {
     $this->areaCode = $areaCode;
     $this->ext = $extension;
     $this->countryCode = $countryCode;
     parent::__construct($name, $title, $value);
 }
开发者ID:congaaids,项目名称:silverstripe-framework,代码行数:7,代码来源:PhoneNumberField.php

示例5: __construct

 /**
  * @param string $name      The name of the field
  * @param string $title     The field label
  * @param GoogleMap $mapObject [description]
  */
 public function __construct($name, $title, $mapObject = null)
 {
     if ($mapObject) {
         $this->setMap($mapObject);
     }
     parent::__construct($name, $title);
 }
开发者ID:helpfulrobot,项目名称:nathancox-mapfield,代码行数:12,代码来源:MapField.php

示例6: NumericField

 function __construct($name, $title = null, $value = "", $form = null)
 {
     // naming with underscores to prevent values from actually being saved somewhere
     $this->xField = new NumericField("{$name}[x]", _t('GeoCoordinateField.X', 'Longitude'));
     $this->yField = new NumericField("{$name}[y]", _t('GeoCoordinateField.Y', 'Latitude'));
     parent::__construct($name, $title, $value, $form);
 }
开发者ID:helpfulrobot,项目名称:silverstripe-solr,代码行数:7,代码来源:GeoCoordinateField.php

示例7: __construct

 public function __construct($name, $title = null, $value = "")
 {
     // naming with underscores to prevent values from actually being saved somewhere
     $this->fieldAmount = new NumericField("{$name}[Amount]", _t('MoneyField.FIELDLABELAMOUNT', 'Amount'));
     $this->fieldCurrency = $this->FieldCurrency($name);
     parent::__construct($name, $title, $value);
 }
开发者ID:miamollie,项目名称:echoAerial,代码行数:7,代码来源:MoneyField.php

示例8: __construct

 /**
  * @param string $name Field name
  * @param null|string $text Short help link description
  * @param string $uid UniqueIdentifier for AdminHelp
  * @param string|boolean $inline Whether to open this item in a new window
  */
 public function __construct($name, $text, $uid, $newWindow = 'default')
 {
     $this->text = $text;
     $this->uid = $uid;
     $this->newWindow = $newWindow;
     parent::__construct($name);
 }
开发者ID:helpfulrobot,项目名称:webtorque7-adminhelp,代码行数:13,代码来源:AdminHelpField.php

示例9: __construct

 /**
  * @param string $name
  * @param string $title
  * @param callable $dataSource
  * @param array $userConfig
  * @param mixed $value
  */
 public function __construct($name, $title = null, $dataSource, $userConfig = array(), $value = null)
 {
     $this->setName($name);
     $this->setDataSource($dataSource)->setConfig($userConfig)->setupChildren();
     parent::__construct($name, $title, $value);
     $this->getRawField()->setTitle($title);
 }
开发者ID:helpfulrobot,项目名称:betterbrief-silverstripe-autocompletefield,代码行数:14,代码来源:AutocompleteField.php

示例10: __construct

 public function __construct($name, $title = null, $value = null, $form = null)
 {
     // Create a callable function that returns an array of options for the DependentDropdownField.
     // When the value of the field it depends on changes, this function is called passing the
     // updated value as the first parameter ($val)
     $getanchors = function ($page_id) {
         // Copied from HtmlEditorField_Toolbar::getanchors()
         if (($page = Page::get()->byID($page_id)) && !empty($page)) {
             //			if (!$page->canView()) { /* ERROR? */ }
             // Similar to the regex found in HtmlEditorField.js / getAnchors method.
             if (preg_match_all("/\\s(name|id)=\"([^\"]+?)\"|\\s(name|id)='([^']+?)'/im", $page->Content, $matches)) {
                 //					var_dump(array_filter(array_merge($matches[2], $matches[4])));
                 $anchors = array_filter(array_merge($matches[2], $matches[4]));
                 return array_combine($anchors, $anchors);
             }
         }
     };
     // naming with underscores to prevent values from actually being saved somewhere
     $this->fieldCustomURL = new TextField("{$name}[CustomURL]", '', '', 300, $form);
     $this->fieldShortcode = new TextField("{$name}[Shortcode]", '', '', 300, $form);
     $this->fieldPageID = new TreeDropdownField("{$name}[PageID]", '', 'SiteTree', 'ID', 'MenuTitle');
     $this->fieldPageID->setForm($form);
     //		$this->fieldPageAnchor = new DropdownField("{$name}[PageAnchor]", 'Anchor:',array(), '', $form);
     // The DependentDropdownField, setting the source as the callable function
     // and setting the field it depends on to the appropriate field
     $this->fieldPageAnchor = DependentDropdownField::create("{$name}[PageAnchor]", 'Text-anchor:', $getanchors, $form)->setEmptyString('Page anchor: (none)')->setDepends($this->fieldPageID);
     $this->fieldFileID = new TreeDropdownField("{$name}[FileID]", '', 'File', 'ID', 'Name');
     $this->fieldFileID->addExtraClass('filetree');
     $this->fieldFileID->setForm($form);
     $this->fieldTitle = new TextField("{$name}[Title]", 'Title: ', '', 300, $form);
     $this->fieldLinkmode = new DropdownField("{$name}[Linkmode]", 'Type: ', array('Page' => 'Page', 'URL' => 'URL', 'File' => 'File', 'Email' => 'Email', 'Shortcode' => 'Shortcode'), '', $form);
     $this->fieldLinkmode->addExtraClass('LinkModePicker');
     parent::__construct($name, $title, $value, $form);
 }
开发者ID:micschk,项目名称:silverstripe-namedlinkfield,代码行数:34,代码来源:NamedLinkFormField.php

示例11:

 /**
  * Create a new action button.
  * @param action The method to call when the button is clicked
  * @param title The label on the button
  * @param form The parent form, auto-set when the field is placed inside a form 
  * @param extraData A piece of extra data that can be extracted with $this->extraData.  Useful for
  *                  calling $form->buttonClicked()->extraData()
  * @param extraClass A CSS class to apply to the button in addition to 'action'
  */
 function __construct($action, $title = "", $form = null, $extraData = null, $extraClass = '')
 {
     $this->extraData = $extraData;
     $this->extraClass = ' ' . $extraClass;
     $this->action = "action_{$action}";
     parent::__construct($this->action, $title, null, $form);
 }
开发者ID:racontemoi,项目名称:shibuichi,代码行数:16,代码来源:FormAction.php

示例12: __construct

 public function __construct($name, $title = null, $value = null, $form = null)
 {
     $allowed_types = $this->stat('allowed_types');
     $field_types = $this->stat('field_types');
     if (empty($allowed_types)) {
         $allowed_types = array_keys($field_types);
     }
     $field = new DropdownField("{$name}[Type]", '', array_combine($allowed_types, $allowed_types));
     $field->setEmptyString('Please choose the Link Type');
     $this->composite_fields['Type'] = $field;
     foreach ($allowed_types as $type) {
         $def = $field_types[$type];
         $field_name = "{$name}[{$type}]";
         switch ($def['field']) {
             case 'TreeDropdownField':
                 $field = new TreeDropdownField($field_name, '', 'SiteTree', 'ID', 'Title');
                 break;
             default:
                 $field = new TextField($field_name, '');
                 break;
         }
         $field->setDescription($def['description']);
         $field->addExtraClass('FlexiLinkCompositeField');
         $this->composite_fields[$type] = $field;
     }
     $this->setForm($form);
     parent::__construct($name, $title, $value, $form);
 }
开发者ID:helpfulrobot,项目名称:briceburg-silverstripe-flexilink,代码行数:28,代码来源:FlexiLinkField.php

示例13: __construct

 public function __construct($parent, $name)
 {
     if (!$parent->hasExtension('MetadataExtension')) {
         throw new Exception('The parent class must have the metadata extension.');
     }
     $this->parent = $parent;
     parent::__construct($name);
 }
开发者ID:helpfulrobot,项目名称:silverstripe-australia-metadata,代码行数:8,代码来源:MetadataSetField.php

示例14: __construct

 /**
  * @param string $name The field name
  * @param string $title The field title
  * @param array|ArrayAccess $source A map of the dropdown items
  * @param mixed $value The current value
  */
 public function __construct($name, $title = null, $source = array(), $value = null)
 {
     $this->setSource($source);
     if (!isset($title)) {
         $title = $name;
     }
     parent::__construct($name, $title, $value);
 }
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:14,代码来源:SelectField.php

示例15:

 /**
  * Create new input field
  * @param string $type
  * @param string $name
  * @param string $value
  */
 function __construct($type, $name = '', $value = '')
 {
     if (!in_array($type, self::$allowedTypes)) {
         throw new \InvalidArgumentException('Unknown Type for input field: ' . $type);
     }
     $this->type = $type;
     parent::__construct($name, $value);
 }
开发者ID:agentmedia,项目名称:phine-framework,代码行数:14,代码来源:Input.php


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