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); } }
/** * 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; }
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; }
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; }
/** * 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; }
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; }
public function getCMSFields() { $fields = new FieldList(); $fields->push(TextField::create("TwitterHandle", "Twitter Handle")); $fields->push(NumericField::create("NumberOfTweets", "Number of Tweets")); return $fields; }
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; }
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; }
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; }
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'); }
/** * 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; }
/** * 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("Item Rate"), CompositeField::create(NumericField::create("FlatRate", "Item Rate (" . Product::getDefaultCurrency() . ")")->setRightTitle("Enter a flat rate of shipping to charge for every item in this order.")))); return $fields; }
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; }
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; }
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.')); } }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab("Root.News", NumericField::create("NewsPageLimit")->setTitle(_t("NewsHolder.NewsPageLimit", "Page limit"))); $NewsGridFieldConfig = GridFieldConfig_RecordEditor::create(); $NewsArticleGrid = GridField::create("NewsArticles", _t("NewsHolder.NewsArticlesTitle", "News articles"), $this->NewsArticles(), $NewsGridFieldConfig); $fields->addFieldToTab("Root.News", $NewsArticleGrid); return $fields; }
/** * {@inheritdoc} */ public function getCMSFields() { $this->beforeUpdateCMSFields(function (FieldList $fields) { $fields[] = DropdownField::create('BlogID', _t('BlogCategoriesWidget.Blog', 'Blog'), Blog::get()->map()); $fields[] = NumericField::create('Limit', _t('BlogCategoriesWidget.Limit.Label', 'Limit'), 0)->setDescription(_t('BlogCategoriesWidget.Limit.Description', 'Limit the number of categories shown by this widget (set to 0 to show all categories).'))->setMaxLength(3); $fields[] = DropdownField::create('Order', _t('BlogCategoriesWidget.Sort.Label', 'Sort'), array('Title' => 'Title', 'Created' => 'Created', 'LastUpdated' => 'Updated'))->setDescription(_t('BlogCategoriesWidget.Sort.Description', 'Change the order of categories shown by this widget.')); $fields[] = DropdownField::create('Direction', _t('BlogCategoriesWidget.Direction.Label', 'Direction'), array('ASC' => 'Ascending', 'DESC' => 'Descending'))->setDescription(_t('BlogCategoriesWidget.Direction.Description', 'Change the direction of ordering of categories shown by this widget.')); }); return parent::getCMSFields(); }
/** * {@inheritdoc} */ public function getCMSFields() { $this->beforeUpdateCMSFields(function ($fields) { /** * @var FieldList $fields */ $fields->merge(array(DropdownField::create('BlogID', _t('BlogRecentPostsWidget.Blog', 'Blog'), Blog::get()->map()), NumericField::create('NumberOfPosts', _t('BlogRecentPostsWidget.NumberOfPosts', 'Number of Posts')))); }); return parent::getCMSFields(); }
public function updateSettingsFields(FieldList $fields) { $message = '<p>Configure this page to use an image slider</p>'; $fields->addFieldToTab('Root.Settings', LiteralField::create("OrbitMessage", $message)); $orbit = FieldGroup::create(CheckboxField::create('ShowOrbit', 'Show an image slider on this page?'))->setTitle('Orbit'); $fields->addFieldToTab('Root.Settings', $orbit); if ($this->owner->ShowOrbit) { $fields->addFieldToTab('Root.Settings', NumericField::create('OrbitWidth', 'Width')); $fields->addFieldToTab('Root.Settings', NumericField::create('OrbitHeight', 'Height')); } }
/** * 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'); //Product Item not yet created $select_product_item = Tab::create("Item", HeaderField::create("Add Order Item"), CompositeField::create(DropdownField::create("OriginalProductID", "Select Product", Product::get()->sort("Title ASC")->map())->setEmptyString("(Select a product)"))); //Product Item has been created $edit_product_item = Tab::create("Item", HeaderField::create("Order Item"), CompositeField::create(ReadonlyField::create("Title", "Product")->setRightTitle("You will need to remove this item and add another should you wish to change the product."), ReadonlyField::create("SKU", "SKU"), FieldGroup::create(NumericField::create("Price", "Cost per item"), DropdownField::create("Discounted", "Is this the sale price?", array("0" => "No", "1" => "Yes")), NumericField::create("Quantity", "Quantity ordered"))->setTitle("Pricing (" . Product::getDefaultCurrency() . ") "), ReadonlyField::create("SubTotal", "Subtotal (" . Product::getDefaultCurrency() . ")", StoreCurrency::convertToCurrency($this->Price * $this->Quantity)), ReadonlyField::create("TAX", $this->TaxClassName . " (" . Product::getDefaultCurrency() . ")", $this->calculateItemTax())->setRightTitle($this->TaxCalculation == 1 ? "Subtotal is inclusive of this tax." : "Subtotal is exclusive of this tax."), ReadonlyField::create("Total", "Total (" . Product::getDefaultCurrency() . ")", $this->TaxCalculation == 1 ? StoreCurrency::convertToCurrency($this->Price * $this->Quantity) : StoreCurrency::convertToCurrency($this->Price * $this->Quantity + $this->calculateItemTax())))); //Create the FieldList and push the either of the above Tabs to the Root TabSet based on if Product Item exists yet or not. $fields = FieldList::create($root = TabSet::create('Root', $this->exists() ? $edit_product_item : $select_product_item)); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $type = $this->dbObject("Type")->enumValues(); foreach ($type as $k => $v) { $type[$k] = _t("BlogArchiveWidget." . ucfirst(strtolower($v)), $v); } $fields->merge(array(DropdownField::create("BlogID", _t("BlogArchiveWidget.Blog", "Blog"), Blog::get()->map()), DropdownField::create("Type", _t("BlogArchiveWidget.Type", "Type"), $type), NumericField::create("NumberToDisplay", _t("BlogArchiveWidget.NumberToDisplay", "No. to Display")))); $this->extend("updateCMSFields", $fields); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $title = TextField::create('Title', 'Title'); $productsPerPage = NumericField::create('ProductsPerPage', 'Products per page')->setDescription('Use 0 to have all products display on a single page.'); $noResultsMessage = TextField::create('NoResultsMessage', 'No results message')->setDescription('The message to display when no products are found in the catalog'); $fields->addFieldToTab('Root.Main', $title); $fields->addFieldToTab('Root.Main', $noResultsMessage); $fields->addFieldToTab('Root.Main', $productsPerPage); return $fields; }
public function updateSettingsFields(FieldList $fields) { $message = '<p>Configure this page to use a carousel</p>'; $fields->addFieldToTab('Root.Settings', LiteralField::create("CarouselMessage", $message)); $carousel = FieldGroup::create(CheckboxField::create('ShowCarousel', 'Show a carousel on this page?'))->setTitle('Carousel'); $fields->addFieldToTab('Root.Settings', $carousel); if ($this->owner->ShowCarousel) { $fields->addFieldToTab('Root.Settings', NumericField::create('CarouselWidth', 'Width')); $fields->addFieldToTab('Root.Settings', NumericField::create('CarouselHeight', 'Height')); } }
/** * CMS Fields * @return array */ public function getCMSFields() { $fields = parent::getCMSFields(); $TeaserConfig = GridFieldConfig_RecordEditor::create(); if ($this->LinkList()->Count() > 0) { $TeaserConfig->addComponent(new GridFieldOrderableRows()); } $fields->removeByName(array('ParentPageID', 'ParentPage', 'LinkLimit', 'LinkList')); $fields->addFieldsToTab('Root.Main', array(TextareaField::create('Title')->setRows(1), DropdownField::create('LinkType', 'Type', array("currentchildren" => "List all sub pages of this page", "children" => "Specify a page and list all its sub pages", "specify" => "Specify each link")), DisplayLogicWrapper::create(TreeDropdownField::create('ParentPageID', 'Select a page', 'SiteTree'))->displayIf("LinkType")->isEqualTo("children")->end(), DisplayLogicWrapper::create(NumericField::create('LinkLimit', 'Limit links')->setDescription("0 equals unlimited amount."))->displayIf("LinkType")->isNotEqualTo("specify")->end(), DisplayLogicWrapper::create(GridField::create('LinkList', 'Current Link(s)', $this->LinkList(), $TeaserConfig))->displayIf("LinkType")->isEqualTo("specify")->end())); $this->extend('updateCMSFields', $fields); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Main', TreeDropdownField::create('SourceFolderID', 'Source folder', 'Folder'), 'Content'); $fields->addFieldToTab('Root.Main', NumericField::create('ItemsPerPage', 'Items per page'), 'Content'); $fileFields = singleton('File')->inheritedDatabaseFields(); $fileFields = array_merge($fileFields, array('Created' => null, 'LastEdited' => null)); $fileFields = ArrayLib::valuekey(array_keys($fileFields)); $fields->addFieldToTab('Root.Main', DropdownField::create('FileSortBy', 'Sort files by', $fileFields), 'Content'); $fields->addFieldToTab('Root.Main', DropdownField::create('FileSortDir', 'Sort direction', self::$sort_dirs_map), 'Content'); return $fields; }
/** * @return FieldList */ public function getCMSFields() { /** @var $fields */ $fields = parent::getCMSFields(); /** ========================================= * Settings * ==========================================*/ /** ----------------------------------------- * Contact Page * ----------------------------------------*/ $fields->addFieldToTab('Root.Main', HeaderField::create('Settings', _t('ContactPage.SettingsHeading', 'Settings')), 'Content'); /** @var TextField $mailTo */ $fields->addFieldToTab('Root.Main', $mailTo = TextField::create('MailTo', _t('ContactPage.Email', 'Email')), 'Content'); $mailTo->setRightTitle('Choose an email address for the contact page to send to'); /** @var TextField $mailCC */ $fields->addFieldToTab('Root.Main', $mailCC = TextField::create('MailCC', _t('ContactPage.MailCC', 'Cc')), 'Content'); $mailCC->setRightTitle(_t('ContactPage.MailCCRightTitle', 'Choose an email, or emails to CC (separate emails with a comma and no space e.g: email1@website.com,email2@website.com)')); /** @var TextField $mailBCC */ $fields->addFieldToTab('Root.Main', $mailBCC = TextField::create('MailBCC', _t('ContactPage.MailBCC', 'Bcc')), 'Content'); /** @var TextareaField $submissionText */ $fields->addFieldToTab('Root.Main', $submissionText = TextareaField::create('SubmitText', _t('ContactPage.SubmitText', 'Submission Text')), 'Content'); $submissionText->setRightTitle(_t('ContactPage.SubmitTextRightTitle', 'Text for contact form submission once the email has been sent i.e "Thank you for your enquiry"')); $fields->addFieldToTab('Root.Main', HeaderField::create('RecaptchaHeading', _t('ContactPage.RecaptchaHeading', 'reCaptcha'), 4), 'Content'); $fields->addFieldToTab('Root.Main', LiteralField::create('RecaptchaDescription', _t('ContactPage.RecaptchaDescription', '<p>By filling in the Site Key, and Secret Key fields a reCaptcha field will be added to the form to protect against spam.</p>')), 'Content'); $fields->addFieldToTab('Root.Main', LiteralField::create('RecaptchaDescriptionInstructions', _t('ContactPage.RecaptchaDescriptionInstructions', '<div class="message"><p><strong>Note:</strong> you can get your SiteKey, and SecretKey at this address <a href="https://www.google.com/recaptcha/" target="_blank">https://www.google.com/recaptcha/</a></p></div>')), 'Content'); $fields->addFieldToTab('Root.Main', TextField::create('ReCaptchaSiteKey', _t('ContactPage.RecaptchaSiteKey', 'Site Key')), 'Content'); $fields->addFieldToTab('Root.Main', TextField::create('ReCaptchaSecretKey', _t('ContactPage.RecaptchaSecretKey', 'Secret Key')), 'Content'); /** ----------------------------------------- * Google Map * ----------------------------------------*/ $fields->addFieldToTab('Root.Map', HeaderField::create('MapHeading', _t('ContactPage.MapHeading', 'Map'))); $fields->addFieldToTab('Root.Map', LiteralField::create('MapDescription', _t('ContactPage.MapDescription', '<p>The Latitude and Longitude fields are required to be populated in order for the map to be displayed.</p>'))); $fields->addFieldToTab('Root.Map', Textfield::create('GoogleAPI', _t('ContactPage.GoogleAPI', 'Maps API (Optional)'))); $fields->addFieldToTab('Root.Map', Textfield::create('Latitude', _t('ContactPage.Latitude', 'Latitude'))); $fields->addFieldToTab('Root.Map', Textfield::create('Longitude', _t('ContactPage.Longitude', 'Longitude'))); $fields->addFieldToTab('Root.Map', LiteralField::create('MapDescriptionInstructions', _t('ContactPage.MapDescriptionInstructions', '<div class="field"><label class="right"><a href="https://support.google.com/maps/answer/18539" target="_blank">How do I find my latitude/longitude?</a></label></div>'))); /** @var NumericField $mapZoom */ $fields->addFieldToTab('Root.Map', $mapZoom = NumericField::create('MapZoom', _t('ContactPage.Zoom', 'Zoom'))); $mapZoom->setRightTitle(_t('ContactPage.Zoom', 'Zoom level: 1-22 - The higher the number the more zoomed in the map will be.')); /** * If only one of the colours is set, display a warning. */ if (!$this->MapColor && $this->WaterColor || $this->MapColor && !$this->WaterColor) { $fields->addFieldToTab('Root.Map', LiteralField::create('MApColorWarning', _t('ContactPage.MapColorWarning', '<div class="message warning"><p><strong>Note:</strong> To activate the map styling, both Map Colour and Water Colour must be set.</p></div>'))); } $fields->addFieldToTab('Root.Map', ColorField::create('MapColor', _t('ContactPage.MapColor', 'Map Colour (Optional)'))); $fields->addFieldToTab('Root.Map', ColorField::create('WaterColor', _t('ContactPage.WaterColor', 'Water Colour (Optional)'))); /** @var TextField $mapSaturation */ $fields->addFieldToTab('Root.Map', $mapSaturation = TextField::create('MapSaturation', _t('ContactPage.MapSaturation', 'Saturation (Optional)'))); $mapSaturation->setRightTitle(_t('ContactPage.MapSaturationRightTitle', 'A range of -100 to 100, -100 being completely grayscale.')); $fields->addFieldToTab('Root.Map', CheckboxField::create('MapMarker', _t('ContactPage.MapMarker', 'Show map marker'))); return $fields; }
/** * @return FieldList */ public function getCMSFields() { /** @var FieldList $fields */ $fields = parent::getCMSFields(); /** ----------------------------------------- * Fields * ----------------------------------------*/ /** @var NumericField $items */ $fields->addFieldToTab('Root.Main', $items = NumericField::create('Items', _t('PortfolioHolder.Items', 'Items')), 'Content'); $items->setRightTitle(_t('PortfolioHolder.ItemsRightTitle', 'Items outside of this limit will be displayed in a paginated list i.e "Page 1 - 2 - 3."')); return $fields; }
public function getCMSFields() { $imagefield = UploadField::create('DefaultPhoto')->setTitle('Default Photo')->setDescription('To be used on individual news pages if feature photo is empty. 2MB max size'); $imagefield->folderName = 'News'; $imagefield->getValidator()->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png'); $imagefield->getValidator()->setAllowedMaxFileSize('2097152'); // 2 MB in bytes $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Categories', GridField::create('NewsCategories', 'Category', $this->NewsCategories(), GridFieldConfig_RecordEditor::create(50))); $fields->addFieldToTab('Root.Authors', GridField::create('NewsAuthors', 'Author', $this->NewsAuthors(), GridFieldConfig_RecordEditor::create(50))); $fields->addFieldsToTab('Root.Config', array(HeaderField::create('ImageHeader')->setTitle('Default Featured Photo Options'), TextField::create('ThumbnailHeight')->setTitle('Feature Photo Height'), TextField::create('ThumbnailWidth')->setTitle('Feature Photo Width'), $imagefield, HeaderField::create('NewsExcerptsHeader')->setTitle('Excerpt Options'), NumericField::create('NewsExcerptsPerPage')->setTitle('News Excerpts Per Page'), HeaderField::create('ShareIcons')->setTitle('Share Icon Options'), CheckboxField::create('ShowShare')->setTitle('Show Share Icons'), DisplayLogicWrapper::create(CheckboxField::create('ShowFacebook')->setTitle('Show Facebook Icon'), CheckboxField::create('ShowTwitter')->setTitle('Show Twitter Icon'), CheckboxField::create('ShowGoogle')->setTitle('Show Google Icon'))->displayIf('ShowShare')->isChecked()->end())); return $fields; }
/** * Updates the CMS with a GridField to manage slides. * @param FieldList $fields */ public function updateCMSFields(FieldList $fields) { $cfg = GridFieldConfig_RelationEditor::create($slides_per_page = 5); # Utilizes SortableGridField if installed # https://github.com/UndefinedOffset/SortableGridField if (class_exists('GridFieldSortableRows')) { $cfg->addComponent(new GridFieldSortableRows('SortOrder')); } $gridField = GridField::create('KBSlides', _t('KBSlide.PLURALNAME', 'Slides'), $this->owner->KBSlides(), $cfg); $width = NumericField::create('Width', _t('KBSlideshow.Width', 'Width'))->setRightTitle(_t('KBSlideshow.WidthHelp', '')); $height = NumericField::create('Height', _t('KBSlideshow.Height', 'Height'))->setRightTitle(_t('KBSlideshow.HeightHelp', '')); $fields->addFieldsToTab('Root.' . _t('KBSlideshow.SINGULARNAME', 'Slideshow'), array($gridField, $width, $height)); }