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


PHP NumericField::create方法代码示例

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


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

示例1: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     // check if the insertbefore field is present (may be added later, in which case the above
     // fields never get added
     //$insertOnTab = $this->owner->getFilterableArchiveConfigValue('pagination_control_tab');
     //$insertBefore = $this->owner->getFilterableArchiveConfigValue('pagination_insert_before');
     $insertOnTab = Config::inst()->get($this->owner->className, 'pagination_control_tab');
     $insertBefore = Config::inst()->get($this->owner->className, 'pagination_insert_before');
     if (!$fields->fieldByName("{$insertOnTab}.{$insertBefore}")) {
         $insertBefore = null;
     }
     //if($this->owner->getFilterableArchiveConfigValue('datearchive_active')){
     if (Config::inst()->get($this->owner->className, 'datearchive_active')) {
         //$fields->addFieldToTab($this->owner->getFilterableArchiveConfigValue('pagination_control_tab'),
         $fields->addFieldToTab(Config::inst()->get($this->owner->className, 'pagination_control_tab'), DropdownField::create('ArchiveUnit', _t('filterablearchive.ARCHIVEUNIT', 'Archive unit'), array('year' => _t('filterablearchive.YEAR', 'Year'), 'month' => _t('filterablearchive.MONTH', 'Month'), 'day' => _t('filterablearchive.DAY', 'Day'))), $insertBefore);
     }
     $pagerField = NumericField::create("ItemsPerPage", _t("filterablearchive.ItemsPerPage", "Pagination: items per page"))->setRightTitle(_t("filterablearchive.LeaveEmptyForNone", "Leave empty or '0' for no pagination"));
     $fields->addFieldToTab($insertOnTab, $pagerField, $insertBefore);
     //
     // Create categories and tag config
     //
     //		$config = GridFieldConfig_RecordEditor::create();
     //		$config->removeComponentsByType("GridFieldAddNewButton");
     //		$config->addComponent(new GridFieldAddByDBField("buttons-before-left"));
     // Lets just use what others have made already...
     $config = GridFieldConfig::create()->addComponent(new GridFieldButtonRow('before'))->addComponent(new GridFieldToolbarHeader())->addComponent(new GridFieldTitleHeader())->addComponent(new GridFieldEditableColumns())->addComponent(new GridFieldDeleteAction())->addComponent(new GridFieldAddNewInlineButton('toolbar-header-right'));
     //if($this->owner->getFilterableArchiveConfigValue('categories_active')){
     if (Config::inst()->get($this->owner->className, 'categories_active')) {
         $fields->addFieldToTab($insertOnTab, $categories = GridField::create("Categories", _t("FilterableArchive.Categories", "Categories"), $this->owner->Categories(), $config), $insertBefore);
     }
     //if($this->owner->getFilterableArchiveConfigValue('tags_active')){
     if (Config::inst()->get($this->owner->className, 'tags_active')) {
         $fields->addFieldToTab($insertOnTab, $tags = GridField::create("Tags", _t("FilterableArchive.Tags", "Tags"), $this->owner->Tags(), $config), $insertBefore);
     }
 }
开发者ID:helpfulrobot,项目名称:micschk-silverstripe-filterablearchive,代码行数:35,代码来源:FilterableArchiveHolderExtension.php

示例2: getCMSFields

 /**
  * getCMSFields
  * Construct the FieldList used in the CMS. To provide a
  * smarter UI we don't use the scaffolding provided by
  * parent::getCMSFields.
  * 
  * @return FieldList
  */
 public function getCMSFields()
 {
     Requirements::css('torindul-silverstripe-shop/css/LeftAndMain.css');
     //Create the FieldList and push the Root TabSet on to it.
     $fields = FieldList::create($root = TabSet::create('Root', Tab::create("Main", HeaderField::create("Add/Edit Currency"), CompositeField::create(DropdownField::create("Enabled", "Enable Currency?", array("1" => "Yes", "2" => "No"))->setRightTitle($this->SystemCreated == 1 ? "DISABLED: You can not disable the default currency." : "Select the country this zone applies to.")->setDisabled($this->SystemCreated == 1 ? true : false), TextField::create("Title", "Currency Name")->setRightTitle("i.e. Great British Pound."), TextField::create("Code", "Currency Code")->setRightTitle("i.e. GBP, USD, EUR."), TextField::create("ExchangeRate", "Exchange Rate")->setRightTitle("i.e. Your new currency is USD, a conversion rate of 1.53 may apply against the local currency."), TextField::create("Symbol", "Currency Symbol")->setRightTitle("i.e. £, \$, €."), DropdownField::create("SymbolLocation", "Symbol Location", array("1" => "On the left, i.e. \$1.00", "2" => "On the right, i.e. 1.00\$", "3" => "Display the currency code instead, i.e. 1 USD."))->setRightTitle("Where should the currency symbol be placed?"), TextField::create("DecimalSeperator", "Decimal Separator")->setRightTitle("What decimal separator does this currency use?"), TextField::create("ThousandsSeparator", "Thousands Separator")->setRightTitle("What thousands separator does this currency use?"), NumericField::create("DecimalPlaces", "Decimal Places")->setRightTitle("How many decimal places does this currency use?")))));
     return $fields;
 }
开发者ID:micschk,项目名称:torindul-silverstripe-shop,代码行数:15,代码来源:StoreCurrency.php

示例3: getCMSFields

 public function getCMSFields($params = null)
 {
     //fields that shouldn't be changed once coupon is used
     $fields = new FieldList(array($tabset = new TabSet("Root", $maintab = new Tab("Main", TextField::create("Title"), CheckboxField::create("Active", "Active")->setDescription("Enable/disable all use of this discount."), HeaderField::create("ActionTitle", "Action", 3), $typefield = SelectionGroup::create("Type", array(new SelectionGroup_Item("Percent", $percentgroup = FieldGroup::create($percentfield = NumericField::create("Percent", "Percentage", "0.00")->setDescription("e.g. 0.05 = 5%, 0.5 = 50%, and 5 = 500%"), $maxamountfield = CurrencyField::create("MaxAmount", _t("MaxAmount", "Maximum Amount"))->setDescription("The total allowable discount. 0 means unlimited.")), "Discount by percentage"), new SelectionGroup_Item("Amount", $amountfield = CurrencyField::create("Amount", "Amount", "\$0.00"), "Discount by fixed amount")))->setTitle("Type"), OptionSetField::create("For", "Applies to", array("Order" => "Entire Order", "Cart" => "Cart Subtotal", "Shipping" => "Shipping Subtotal", "Items" => "Each Individual Item")), new Tab("Main", HeaderField::create("ConstraintsTitle", "Constraints", 3), LabelField::create("ConstraintsDescription", "Configure the requirements an order must meet for this discount to be valid:")), new TabSet("Constraints")))));
     if (!$this->isInDB()) {
         $fields->addFieldToTab("Root.Main", LiteralField::create("SaveNote", "<p class=\"message good\">More constraints will show up after you save for the first time.</p>"), "Constraints");
     }
     $this->extend("updateCMSFields", $fields, $params);
     if ($count = $this->getUseCount()) {
         $fields->addFieldsToTab("Root.Usage", array(HeaderField::create("UseCount", sprintf("This discount has been used {$count} time%s.", $count > 1 ? "s" : "")), HeaderField::create("TotalSavings", sprintf("A total of %s has been saved by customers using this discount.", $this->SavingsTotal), "3"), GridField::create("Orders", "Orders", $this->getAppliedOrders(), GridFieldConfig_RecordViewer::create()->removeComponentsByType("GridFieldViewButton"))));
     }
     if ($params && isset($params['forcetype'])) {
         $valuefield = $params['forcetype'] == "Percent" ? $percentfield : $amountfield;
         $fields->insertAfter($valuefield, "Type");
         $fields->removeByName("Type");
     } elseif ($this->Type && (double) $this->{$this->Type}) {
         $valuefield = $this->Type == "Percent" ? $percentfield : $amountfield;
         $fields->removeByName("Type");
         $fields->insertAfter($valuefield, "ActionTitle");
         $fields->replaceField($this->Type, $valuefield->performReadonlyTransformation());
         if ($this->Type == "Percent") {
             $fields->insertAfter($maxamountfield, "Percent");
         }
     }
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:silvershop-discounts,代码行数:26,代码来源:Discount.php

示例4: getCMSFields

 public function getCMSFields()
 {
     $fields = new FieldList();
     $fields->push(new TabSet("Root", new Tab("Main", TextField::create("Title", "Title"), GridField::create("Slides", "Nivo Slide", $this->Slides(), GridFieldConfig_RecordEditor::create())), new Tab("Advanced", DropdownField::create("Theme", "Theme", self::get_all_themes()), DropdownField::create("Effect", "Effect", $this->dbObject("Effect")->enumValues()), NumericField::create("AnimationSpeed", "Animation Speed")->setDescription("Animation speed in milliseconds."), NumericField::create("PauseTime", "Pause Time")->setDescription("Pause time on each frame in milliseconds."), TextField::create("PrevText", "Previous Text"), TextField::create("NextText", "Next Text"), NumericField::create("Slices", "Slices")->setDescription("Number of slices for slice animation effects."), NumericField::create("BoxCols", "Box Columns")->setDescription("Number of box columns for box animation effects."), NumericField::create("BoxRows", "Box Rows")->setDescription("Number of box rows for box animation effects."), NumericField::create("StartSlide", "Start Slide")->setDescription("Slide to start on (0 being the first)."), HeaderField::create("ControlHeading", "Control Options", 4), CompositeField::create(array(CheckboxField::create("DirectionNav", "Display Direction Navigation?"), CheckboxField::create("ControlNav", "Display Control Navigation?"), CheckboxField::create("ControlNavThumbs", "Use thumbnails for control nav?"), CheckboxField::create("PauseOnHover", "Stop the animation whilst hovering?"), CheckboxField::create("ManualAdvance", "Force manual transition?"), CheckboxField::create("RandomStart", "Random Start?"))))));
     $fields->extend("updateCMSFields", $fields);
     return $fields;
 }
开发者ID:SpiritLevel,项目名称:silverstripe-nivoslider,代码行数:7,代码来源:NivoSlider.php

示例5: updateCMSFields

 /**
  * Adds our SEO Meta fields to the page field list
  *
  * @since version 1.0.0
  *
  * @param string $fields The current FieldList object
  *
  * @return object Return the FieldList object
  **/
 public function updateCMSFields(FieldList $fields)
 {
     $fields->removeByName('HeadTags');
     $fields->removeByName('SitemapImages');
     if (!$this->owner instanceof Page) {
         $fields->addFieldToTab('Root.Page', HeaderField::create('Page'));
         $fields->addFieldToTab('Root.Page', TextField::create('Title', 'Page name'));
     }
     $fields->addFieldToTab('Root.PageSEO', $this->preview());
     $fields->addFieldToTab('Root.PageSEO', TextField::create('MetaTitle'));
     $fields->addFieldToTab('Root.PageSEO', TextareaField::create('MetaDescription'));
     $fields->addFieldToTab('Root.PageSEO', HeaderField::create(false, 'Indexing', 2));
     $fields->addFieldToTab('Root.PageSEO', TextField::create('Canonical'));
     $fields->addFieldToTab('Root.PageSEO', DropdownField::create('Robots', 'Robots', SEO_FieldValues::IndexRules()));
     $fields->addFieldToTab('Root.PageSEO', NumericField::create('Priority'));
     $fields->addFieldToTab('Root.PageSEO', DropdownField::create('ChangeFrequency', 'Change Frequency', SEO_FieldValues::SitemapChangeFrequency()));
     $fields->addFieldToTab('Root.PageSEO', CheckboxField::create('SitemapHide', 'Hide in sitemap? (XML and HTML)'));
     $fields->addFieldToTab('Root.PageSEO', HeaderField::create('Social Meta'));
     $fields->addFieldToTab('Root.PageSEO', CheckboxField::create('HideSocial', 'Hide Social Meta?'));
     $fields->addFieldToTab('Root.PageSEO', DropdownField::create('OGtype', 'Open Graph Type', SEO_FieldValues::OGtype()));
     $fields->addFieldToTab('Root.PageSEO', DropdownField::create('OGlocale', 'Open Graph Locale', SEO_FieldValues::OGlocale()));
     $fields->addFieldToTab('Root.PageSEO', DropdownField::create('TwitterCard', 'Twitter Card', SEO_FieldValues::TwitterCardTypes()));
     $fields->addFieldToTab('Root.PageSEO', $this->SharingImage());
     $fields->addFieldToTab('Root.PageSEO', HeaderField::create('Other Meta Tags'));
     $fields->addFieldToTab('Root.PageSEO', $this->OtherHeadTags());
     $fields->addFieldToTab('Root.PageSEO', HeaderField::create('Sitemap Images'));
     $fields->addFieldToTab('Root.PageSEO', $this->SitemapImagesGrid());
     $fields->addFieldToTab('Root.PageSEO', LiteralField::create(false, '<br><br>Silverstripe SEO v1.0'));
     return $fields;
 }
开发者ID:Cyber-Duck,项目名称:Silverstripe-SEO,代码行数:39,代码来源:SEO_Extension.php

示例6: getCMSFields

 public function getCMSFields()
 {
     $fields = FieldList::create();
     $fields->merge(array(DropdownField::create("BlogID", _t("BlogRecentPostsWidget.Blog", "Blog"), Blog::get()->map()), NumericField::create("NumberOfPosts", _t("BlogRecentPostsWidget.NumberOfPosts", "Number of Posts"))));
     $this->extend("updateCMSFields", $fields);
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:micmania1-silverstripe-blog,代码行数:7,代码来源:BlogRecentPostsWidget.php

示例7: getCMSFields

 public function getCMSFields()
 {
     $fields = new FieldList();
     $fields->push(TextField::create("TwitterHandle", "Twitter Handle"));
     $fields->push(NumericField::create("NumberOfTweets", "Number of Tweets"));
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:micmania1-sstwitter,代码行数:7,代码来源:LatestTweetsWidget.php

示例8: Inputs

 public function Inputs()
 {
     if (count($this->linkedFields)) {
         return \ArrayList::create();
     }
     $ranged = is_array($this->settings['start']) && count($this->settings['start']) > 1;
     $minName = $ranged ? 'min' : 'value';
     $fields[$minName] = ['Render' => $this->castedCopy(\NumericField::create($this->Name . '[' . $minName . ']'))];
     $fields[$minName]['Render']->Value = is_array($this->settings['start']) ? $this->settings['start'][0] : $this->settings['start'];
     if ($ranged) {
         $fields['max'] = ['Render' => $this->castedCopy(\NumericField::create($this->Name . '[max]'))];
         $fields['max']['Render']->Value = $this->settings['start'][1];
     }
     $count = 0;
     array_walk($fields, function ($field) use(&$count) {
         if (!isset($field['Handle'])) {
             $field['Handle'] = $count % 2 ? 'upper' : 'lower';
         }
         if (isset($field['Render'])) {
             $field['Render']->removeExtraClass('rangeslider-display')->addExtraClass('rangeslider-linked')->setAttribute('data-rangeslider-handle', $field['Handle']);
         }
         $count++;
     });
     $fields = \ArrayList::create(array_map(function ($field) {
         return \ArrayData::create($field);
     }, $fields));
     if ($this->inputCallback && is_callable($this->inputCallback)) {
         call_user_func_array($this->inputCallback, [$fields]);
     }
     $this->extend('updateInputs', $fields);
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:milkyway-multimedia-ss-mwm-formfields,代码行数:32,代码来源:RangeSliderField.php

示例9: SelectForm

 function SelectForm()
 {
     $fieldList = new FieldList(NumericField::create("Year", "Manufacturing Year"), DropdownField::create("Make", "Make", array(0 => $this->pleaseSelectPhrase())), DropdownField::create("Model", "Model", array(0 => $this->pleaseSelectPhrase())), DropdownField::create("Type", "Type", array(0 => $this->pleaseSelectPhrase())), NumericField::create("ODO", "Current Odometer (overall distance travelled - as shown in your dashboard"));
     $actions = new FieldList(FormAction::create("doselectform")->setTitle("Start Calculation"));
     $form = Form::create($this, "SelectForm", $fieldList, $actions);
     return $form;
 }
开发者ID:sunnysideup,项目名称:silverstripe-electric-vehicle-calculator,代码行数:7,代码来源:EVCSelectPage.php

示例10: formField

 public function formField()
 {
     $field = $this->removeFields(parent::formField(), ['action', 'scheme', 'show_faces', 'share', 'for_kids']);
     $field->push(\DropdownField::create('mobile', _t('Shortcodable.FB-MOBILE', 'Display mobile compatible version'), ['' => '(Automatic)', 'true' => 'Yes', 'false' => 'No']));
     $field->push(\NumericField::create('num_posts', _t('Shortcodable.FB-NUM_POSTS', 'Number of posts'), 30));
     $field->push(\DropdownField::create('order_by', _t('Shortcodable.FB-ORDER_BY', 'Order by'), ['' => 'Social (active)', 'reverse_time' => 'Created DESC', 'time' => 'Created ASC']));
     return $field;
 }
开发者ID:spekulatius,项目名称:ss-social-feed,代码行数:8,代码来源:Facebook_Comments.php

示例11: Field

 public function Field()
 {
     $qtyArray = array();
     for ($r = 1; $r <= $this->max; $r++) {
         $qtyArray[$r] = $r;
     }
     return NumericField::create($this->MainID() . '_Quantity', _t('Order.Quantity', "Quantity"), $this->item->Quantity)->setAttribute('type', 'number');
 }
开发者ID:burnbright,项目名称:silverstripe-shop,代码行数:8,代码来源:ShopQuantityField.php

示例12: getCMSFields

 /**
  * Add fields to the CMS for this courier.
  */
 public function getCMSFields()
 {
     //Fetch the fields from the Courier DataObject
     $fields = parent::getCMSFields();
     //Add new fields
     $fields->addFieldsToTab("Root.Main", array(HeaderField::create("Minimum Spend"), CompositeField::create(NumericField::create("MinSpend", "Qualifying Spend (" . Product::getDefaultCurrency() . ")")->setRightTitle("Enter the amount a customer must spend before qualifying for Free Shipping."))));
     return $fields;
 }
开发者ID:micschk,项目名称:torindul-silverstripe-shop,代码行数:11,代码来源:Courier_FreeShipping.php

示例13: TypoForm

 function TypoForm()
 {
     $array = array('green', 'yellow', 'blue', 'pink', 'orange');
     $form = new Form($this, 'TestForm', $fields = FieldList::create(HeaderField::create('HeaderField1', 'HeaderField Level 1', 1), LiteralField::create('LiteralField', '<p>All fields up to EmailField are required and should be marked as such</p>'), TextField::create('TextField1', 'Text Field Example 1'), TextField::create('TextField2', 'Text Field Example 2'), TextField::create('TextField3', 'Text Field Example 3'), TextField::create('TextField4', ''), HeaderField::create('HeaderField2b', 'Field with right title', 2), $textAreaField = new TextareaField('TextareaField', 'Textarea Field'), EmailField::create('EmailField', 'Email address'), HeaderField::create('HeaderField2c', 'HeaderField Level 2', 2), DropdownField::create('DropdownField', 'Dropdown Field', array(0 => '-- please select --', 1 => 'test AAAA', 2 => 'test BBBB')), OptionsetField::create('OptionSF', 'Optionset Field', $array), CheckboxSetField::create('CheckboxSF', 'Checkbox Set Field', $array), CountryDropdownField::create('CountryDropdownField', 'Countries'), CurrencyField::create('CurrencyField', 'Bling bling', '$123.45'), HeaderField::create('HeaderField3', 'Other Fields', 3), NumericField::create('NumericField', 'Numeric Field '), DateField::create('DateField', 'Date Field'), DateField::create('DateTimeField', 'Date and Time Field'), CheckboxField::create('CheckboxField', 'Checkbox Field')), $actions = FieldList::create(FormAction::create('submit', 'Submit Button')), $requiredFields = RequiredFields::create('TextField1', 'TextField2', 'TextField3', 'ErrorField1', 'ErrorField2', 'EmailField', 'TextField3', 'RightTitleField', 'CheckboxField', 'CheckboxSetField'));
     $textAreaField->setColumns(45);
     $form->setMessage('warning message', 'warning');
     return $form;
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-typography,代码行数:8,代码来源:Typography.php

示例14: newGameForm

 public function newGameForm()
 {
     $fields = new FieldList(NumericField::create('ScoreTeamOne', 'Score Team One'), NumericField::create('ScoreTeamTwo', 'Score Team Two'));
     $actions = new FieldList(FormAction::create("doAddGame")->setTitle("Add Game"));
     $required = new RequiredFields('ScoreTeamOne', 'ScoreTeamTwo');
     $form = Form::create($this, 'doAddGame', $fields, $actions, $required);
     $form->setTemplate('forms/NewGameForm');
     return $form;
 }
开发者ID:jackmarchant,项目名称:foosfirst,代码行数:9,代码来源:GamesPage.php

示例15: getValueField

 public function getValueField()
 {
     $fields = array('Boolean' => CheckboxField::create("Value"), 'Number' => NumericField::create("Value"), 'String' => TextField::create("Value"));
     if (isset($fields[$this->ValueType])) {
         return $fields[$this->ValueType];
     } else {
         return new LiteralField("Value", _t('Feature.SAVETOADDVALUE', 'Save record to add value.'));
     }
 }
开发者ID:helpfulrobot,项目名称:burnbright-silverstripe-shop-comparison,代码行数:9,代码来源:Feature.php


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