public function getCMSFields() { //Fetch curret fields and store in Fields $fields = parent::getCMSFields(); //Remove Fields $fields->removeFieldFromTab("Root.Main", array("SortOrder", "CalendarID", "Title", "Content", "StartDate", "StartTime", "EndDate", "EndTime", "Location")); //Event Title $Title = new TextField("Title", "Event Title"); $Title->setRightTitle("Enter the event title. i.e. sports day."); //Start Date & Time $StartDate = new DateField("StartDate", "Start Date"); $StartDate->setConfig('showcalendar', 1); $StartDate->setConfig('dateformat', 'dd/MM/YYYY'); $StartTime = new TimeField("StartTime", "Start Time (Optional)"); $StartTime->setConfig('use_strtotime', 1); //End Date & Time $EndDate = new DateField("EndDate", "End Date (Optional)"); $EndDate->setConfig('showcalendar', 1); $EndDate->setConfig('dateformat', 'dd/MM/YYYY'); $EndTime = new TimeField("EndTime", "End Time (Optional)"); $StartTime->setConfig('use_strtotime', 1); //Location $Location = new AddressTextField("Location", "Event Location", "AIzaSyA-folYpPWGiFcpBZURJpf610nO6FJtqqQ"); $Location->SetRightTitle("Optional. Begin typing and you will see address suggestions (Beta). Powered by Google."); $Location->addExtraClass("text"); //Event Description $Description = new HTMLEditorField("Content", "Event Description"); //Group Start and End Date & Time Fields $Times = FieldGroup::create($StartDate, $StartTime, $EndDate, $EndTime)->setTitle('Timings'); //Add Fields to the CMS $fields->addFieldsToTab("Root.Main", array($Title, $Times, $Location, $Description)); //Return Fields to the CMS return $fields; }
/** * @return FieldList */ public function getCMSFields() { /** ========================================= * @var FieldList $fields * @var FieldGroup $settings * @var UploadField $image * @var GridFieldConfig_RelationEditor $config * @var GridField $gridField ===========================================*/ $fields = FieldList::create(TabSet::create('Root')); $fields->addfieldToTab('Root.Main', $title = TextField::create('Title')); $title->setRightTitle('Title used in the cms as a visual cue for this piece of content.'); $fields->addFieldToTab('Root.Main', $settings = FieldGroup::create(array(CheckboxField::create('IsFullWidth', 'Container full width')))); $settings->setTitle('Settings'); $fields->addFieldToTab('Root.Main', HeaderField::create('', 'Style')); $fields->addFieldToTab('Root.Main', DesignField::create('Style', 'Container', '.container', array('padding-top' => 'TextField', 'padding-bottom' => 'TextField', 'margin-top' => 'TextField', 'margin-bottom' => 'TextField', 'color' => 'ColorField', 'background' => 'ColorField'))); $fields->addFieldToTab('Root.Main', HeaderField::create('', 'Background (optional)', 4)); $fields->addFieldToTab('Root.Main', $image = UploadField::create('Image', _t('PageBuilderContainer.IMAGE', 'Image'))); $image->setAllowedExtensions(array('jpeg', 'jpg', 'gif', 'png')); $image->setFolderName('Uploads/site-builder/containers'); $fields->addFieldToTab('Root.Main', DropdownField::create('BackgroundType', 'Type', $this->dbObject('BackgroundType')->enumValues())); $config = GridFieldConfig_RelationEditor::create(10); $config->addComponent(GridFieldOrderableRows::create('SortOrder'))->addComponent(new GridFieldDeleteAction()); $gridField = GridField::create('Items', 'Items', $this->Items(), $config); $gridField->addExtraClass('hide'); $fields->addFieldToTab('Root.Main', $gridField); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); // Main Content tab // Carousel tab $carouselItemsGrid = null; // Manay to many relations can only be established if we have an id. So put a place holder instead of a grid if this is a new object. if ($this->ID == 0) { $carouselItemsGrid = TextField::create("CarouselItems", "Carousel Items")->setDisabled(true)->setValue("Page must be saved once before adding Carousel Items."); } else { $carouselItemsGrid = new GridField('CarouselItems', 'Carousel', $this->CarouselItems()->sort('Archived'), GridFieldConfig_RelationEditor::create()); $carouselItemsGridUploadComponent = new GridFieldBulkUpload("Image"); $carouselItemsGridUploadComponent->setUfSetup("setFolderName", $this->ImageFolder("carousel")); $carouselItemsGrid->setModelClass('CarouselItem')->getConfig()->addComponent($carouselItemsGridUploadComponent)->addComponent(new GridFieldOrderableRows("SortID")); } $fields->addFieldToTab('Root.Carousel', $carouselItemsGrid); // Links $fields->addFieldToTab('Root.Links', new TreeDropdownField('LearnMorePageID', 'Page to link the "Learn More" button to:', 'SiteTree')); $fields->addFieldToTab('Root.Links', new TextField('LearnMoreButtonText', 'Text to display on the "Learn More" button:', 'SiteTree')); $quickLinksGrid = new GridField('Quicklinks', 'Quicklinks', $this->Quicklinks(), GridFieldConfig_RelationEditor::create()); $quickLinksGrid->setModelClass('Quicklink'); $quickLinksFieldGroup = FieldGroup::create($quickLinksGrid)->setTitle('Quick Links'); $quickLinksFieldGroup->setName("QuicklinkGroup"); $fields->addFieldToTab('Root.Links', $quickLinksFieldGroup); $fields->removeByName('Translations'); $fields->removeByName('Import'); $fields->addFieldToTab('Root.Features', ToggleCompositeField::create('FeatureOne', _t('SiteTree.FeatureOne', 'Feature One'), array(new TextField('FeatureOneTitle', 'Title'), new DropdownField('FeatureOneCategory', 'Category', singleton('ExpressHomePage')->dbObject('FeatureOneCategory')->enumValues()), new HTMLEditorField('FeatureOneContent', 'Content'), new TreeDropdownField('FeatureOneLinkID', 'Page to link to', 'SiteTree'), new TextField('FeatureOneButtonText', 'Button text')))->setHeadingLevel(3)); $fields->addFieldToTab('Root.Features', ToggleCompositeField::create('FeatureTwo', _t('SiteTree.FeatureTwo', 'Feature Two'), array(new TextField('FeatureTwoTitle', 'Title'), new DropdownField('FeatureTwoCategory', 'Category', singleton('ExpressHomePage')->dbObject('FeatureTwoCategory')->enumValues()), new HTMLEditorField('FeatureTwoContent', 'Content'), new TreeDropdownField('FeatureTwoLinkID', 'Page to link to', 'SiteTree'), new TextField('FeatureTwoButtonText', 'Button text')))->setHeadingLevel(3)); return $fields; }
public function getSettingsFields() { $fields = parent::getSettingsFields(); $gallery = FieldGroup::create(CheckboxField::create('HideDescription', 'Hide the description of each image?'))->setTitle('Gallery'); $fields->addFieldToTab('Root.Settings', $gallery); return $fields; }
function updateSettingsFields(FieldList $fields) { $children = FieldGroup::create(CheckboxField::create('ShowChildren', 'Show children in the content area?'))->setTitle('Children of this page'); $fields->addFieldToTab('Root.Settings', $children); $contact = FieldGroup::create(CheckboxField::create('ShowContact', 'Show contact info on this page?'))->setTitle('Contact Info (from settings)'); $fields->addFieldToTab('Root.Settings', $contact); }
public function updateCMSFields(\FieldList $fields) { if (!Config::inst()->get('VersionFeed', 'allchanges_enabled')) { return; } $fields->addFieldToTab('Root.Access', FieldGroup::create(new CheckboxField('AllChangesEnabled', $this->owner->fieldLabel('AllChangesEnabled')))->setTitle(_t('VersionFeedSiteConfig.ALLCHANGES', 'All page changes'))->setDescription(_t('VersionFeed.Warning', "Publicising the history will also disclose the changes that have at the time been protected " . "from the public view."))); }
/** * @param FieldList $fields * @return FieldList */ public function updateSettingsFields(FieldList $fields) { /** @var FieldGroup $hideDefaultSlider */ $fields->addFieldToTab('Root.Settings', $hideDefaultSlider = FieldGroup::create(CheckboxField::create('HideDefaultSlider', 'Hide the slider from this page'))); $hideDefaultSlider->setTitle('Slider'); 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 = parent::getCMSFields(); // Remove fields $fields->removeByName(array('Unique', 'Permanent', 'CanClose', 'CloseColor', 'LinkID')); // Add fields // Main tab $fields->addFieldToTab("Root.Main", $test = TextField::create("ButtonText")->setTitle(_t("SiteMessage.LABELBUTTONTEXT", "Button Text"))); $fields->addFieldToTab("Root.Main", TreeDropdownField::create("PageID")->setTitle(_t("SiteMessage.LABELLINKTO", "Link to"))->setSourceObject("SiteTree")); $fields->addFieldToTab("Root.Main", HTMLEditorField::create("Content")->setTitle(_t("SiteMessage.LABELCONTENT", "Message content"))->setRows(15)); // Design tab $fields->addFieldToTab("Root.Design", HeaderField::create("ColorSettings")->setTitle(_t("SiteMessage.HEADERCOLORSETTINGS", "Color settings"))); $fields->addFieldToTab("Root.Design", ColorField::create("BackgroundColor")->setTitle(_t("SiteMessage.LABELBACKGROUNDCOLOR", "Background Color"))); $fields->addFieldToTab("Root.Design", ColorField::create("TextColor")->setTitle(_t("SiteMessage.LABELTEXTCOLOR", "Text Color"))); $fields->addFieldToTab("Root.Design", ColorField::create("ButtonColor")->setTitle(_t("SiteMessage.LABELBUTTONCOLOR", "Button Color"))); $fields->addFieldToTab("Root.Design", ColorField::create("ButtonTextColor")->setTitle(_t("SiteMessage.LABELBUTTONTEXTCOLOR", "Button Text Color"))); $fields->addFieldToTab("Root.Design", HeaderField::create("CloseSettings")->setTitle(_t("SiteMessage.HEADERCLOSESETTINGS", "Close button settings"))); $fields->addFieldToTab("Root.Design", FieldGroup::create(_t("SiteMessage.LABELCANCLOSE", "Show close button?"), Checkboxfield::create("CanClose", ""))); $fields->addFieldToTab("Root.Design", ColorField::create("CloseColor")->setTitle(_t("SiteMessage.LABELCLOSECOLOR", "Close button color"))); // Schedule tab $fields->addFieldToTab("Root.Schedule", FieldGroup::create(_t("SiteMessage.LABELPERMANENT", "Is this message permanent?"), CheckboxField::create("Permanent", ""))); $fields->addFieldToTab("Root.Schedule", $Start = new DatetimeField("Start")); $fields->addFieldToTab("Root.Schedule", $End = new DatetimeField("End")); $Start->setConfig('datavalueformat', 'YYYY-MM-dd HH:mm')->setTitle(_t("SiteMessage.LABELSTART", "Start Date"))->getDateField('Start')->setConfig('showcalendar', TRUE); $End->setConfig('datavalueformat', 'YYYY-MM-dd HH:mm')->setTitle(_t("SiteMessage.LABELSTART", "End Date"))->getDateField('End')->setConfig('showcalendar', TRUE); return $fields; }
/** * If this extension is applied to a {@link SiteTree} record then * append a Provide Comments checkbox to allow authors to trigger * whether or not to display comments * * @todo Allow customization of other {@link Commenting} configuration * * @param FieldList $fields */ public function updateSettingsFields(FieldList $fields) { $options = FieldGroup::create()->setTitle(_t('CommentsExtension.COMMENTOPTIONS', 'Comments')); // Check if enabled setting should be cms configurable if ($this->owner->getCommentsOption('enabled_cms')) { $options->push(new CheckboxField('ProvideComments', _t('Comment.ALLOWCOMMENTS', 'Allow Comments'))); } // Check if we should require users to login to comment if ($this->owner->getCommentsOption('require_login_cms')) { $options->push(new CheckboxField('CommentsRequireLogin', _t('Comments.COMMENTSREQUIRELOGIN', 'Require login to comment'))); } if ($options->FieldList()->count()) { if ($fields->hasTabSet()) { $fields->addFieldsToTab('Root.Settings', $options); } else { $fields->push($options); } } // Check if moderation should be enabled via cms configurable if ($this->owner->getCommentsOption('require_moderation_cms')) { $moderationField = new DropdownField('ModerationRequired', 'Comment Moderation', array('None' => _t('CommentsExtension.MODERATIONREQUIRED_NONE', 'No moderation required'), 'Required' => _t('CommentsExtension.MODERATIONREQUIRED_REQUIRED', 'Moderate all comments'), 'NonMembersOnly' => _t('CommentsExtension.MODERATIONREQUIRED_NONMEMBERSONLY', 'Only moderate non-members'))); if ($fields->hasTabSet()) { $fields->addFieldsToTab('Root.Settings', $moderationField); } else { $fields->push($moderationField); } } }
public function getCMSFields() { $datetimeField = DatetimeField::create("Date")->setTitle($this->fieldLabel("Date")); $datetimeField->getDateField()->setConfig("dmyfields", true); // Check if NewsImage should be saved in a seperate folder if (self::config()->save_image_in_seperate_folder == false) { $UploadField = UploadField::create("NewsImage")->setTitle($this->fieldLabel("NewsImage"))->setFolderName("news"); } else { if ($this->ID == "0") { $UploadField = FieldGroup::create(LiteralField::create("Save", $this->fieldLabel("SaveHelp")))->setTitle($this->fieldLabel("NewsImage")); } else { $UploadField = UploadField::create("NewsImage")->setTitle($this->fieldLabel("NewsImage"))->setFolderName("news/" . $this->URLSegment); } } // Create direct link to NewsArticle if ($this->ID == "0") { // Little hack to hide $urlsegment when article isn't saved yet. $urlsegment = LiteralField::create("NoURLSegmentYet", ""); } else { if ($NewsHolder = $this->NewsHolder()) { $baseLink = Controller::join_links(Director::absoluteBaseURL(), $NewsHolder->Link(), $this->URLSegment); } $urlsegment = Fieldgroup::create(LiteralField::create("URLSegment", "URLSegment")->setContent('<a href="' . $baseLink . '" target="_blank">' . $baseLink . '</a>'))->setTitle("URLSegment"); } $fields = FieldList::create(new TabSet("Root", new Tab("Main", $urlsegment, TextField::create("Title")->setTitle($this->fieldLabel("Title")), $datetimeField, HTMLEditorField::create("Content")->setTitle($this->fieldLabel("Content")), $UploadField))); $this->extend("updateCMSFields", $fields); return $fields; }
/** * Add fields to the CMS for this gateway. */ public function getCMSFields() { //Fetch the fields from the Courier DataObject $fields = parent::getCMSFields(); //Add new fields $fields->addFieldsToTab("Root.Main", array(HeaderField::create("PayPal Transaction Information"), CompositeField::create(ReadonlyField::create("custom", "Order Number"), ReadonlyField::create("payment_date", "Payment Date"), ReadonlyField::create("payment_status", "Payment Status")->setRightTitle("\n\t\t\t\t\tIf this status is pending, see Pending Reason below. \n\t\t\t\t"), ReadonlyField::create("payment_type", "Payment Type")->setRightTitle("\n\t\t\t\t\tFor a explanation of the different payment types please see 'payment_type' at \n\t\t\t\t\t<a href=\"https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/\">paypal.com</a>\n\t\t\t\t"), ReadonlyField::create("pending_reason", "Pending Reason")->setRightTitle("\n\t\t\t\t\tFor a explanation of pending reasons please see 'pending_reason' at \n\t\t\t\t\t<a href=\"https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/\">paypal.com</a>\n\t\t\t\t"), ReadonlyField::create("reason_code", "Reason Code")->setRightTitle("\n\t\t\t\t\tThis is set if Payment Status is Reversed, Refunded, Canceled_Reversal, or Denied. For an explanation of its\n\t\t\t\t\tmeaning see 'reason_code' at \n\t\t\t\t\t<a href=\"https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/\">paypal.com</a>\n\t\t\t\t"), FieldGroup::create("Transaction Identifiers", ReadonlyField::create("txn_id", "<strong>Transaction ID</strong>"), ReadonlyField::create("parent_txn_id", "<strong>Parent Transaction ID</strong>"))->setRightTitle("\n\t\t\t\t\t<strong>Transaction ID</strong><br />\n\t\t\t\t\tThe identifier for this specific transaction entry.\n\t\t\t\t\t\n\t\t\t\t\t<br /><br />\n\t\t\t\t\t\n\t\t\t\t\t<strong>Parent Transaction ID</strong><br />\n\t\t\t\t\tIf provided, this value is the transaction identifier of the\n\t\t\t\t\tparent transaction. i.e. If this transaction is a refund, the\n\t\t\t\t\tvalue will be the transaction ID of the original purchase.\n\t\t\t\t\t<br />\n\t\t\t\t"), FieldGroup::create("Funds", ReadonlyField::create("mc_gross", "<strong>Gross Payment</strong>"), ReadonlyField::create("mc_fee", "<strong>PayPal Fee</strong>"))->setRightTitle("\n\t\t\t\t\t<strong>Gross Payment</strong><br />\n\t\t\t\t\tFull amount of the customer's payment, before transaction fee is subtracted.\n\t\t\t\t\t\n\t\t\t\t\t<br /><br />\n\t\t\t\t\t\n\t\t\t\t\t<strong>PayPal Fee</strong><br />\n\t\t\t\t\tTransaction fee associated with the payment.\n\t\t\t\t")))); return $fields; }
public function getCMSFields() { $fields = singleton('DataObject')->getCMSFields(); $type_map = $this->dbObject('MetaType')->enumValues(); $group = FieldGroup::create(FieldGroup::create(TextField::create('Telephone', 'Phone Number'), CheckboxField::create('MetaFax', 'Is Fax'), CheckboxField::create('MetaTollFree', 'Toll Free')), FieldGroup::create(TextField::create('Label', 'Label (optional)')), FieldGroup::create(DropdownField::create('MetaType', 'Meta Type', $type_map))); $fields->addFieldToTab('Root.Main', $group); return $fields; }
/** * @return mixed */ public function getCMSFields() { $fields = singleton('DataObject')->getCMSFields(); $type_map = $this->config()->flexiemail_metatype; $group = FieldGroup::create(FieldGroup::create(TextField::create('Email', 'Email address')), FieldGroup::create(TextField::create('Label', 'Label (optional)')), FieldGroup::create(DropdownField::create('MetaType', 'Meta Type', $type_map, 1))); $fields->addFieldToTab('Root.Main', $group); return $fields; }
/** * @param FieldList $fields * @return FieldList */ public function updateSettingsFields(FieldList $fields) { /** Use FieldGroups to set left titles for the checkboxes. * * @var FieldGroup $hideSidebar */ $fields->addFieldToTab('Root.Settings', $hideSidebar = FieldGroup::create(CheckboxField::create('HideSidebar', _t('BoilerplatePageExtension.HideSidebar', 'Hide the sidebar from this page')))); $hideSidebar->setTitle(_t('BoilerplatePageExtension.HideSidebarTitle', 'Sidebar')); }
/** * Updates the CMS Form in the backend, generating an edit form for the movie details. * * As the Movie-page will solely show the movie details and no further content, the HTML-Content * editfield has been removed. * * This editform uses a new MovieAutoComplete formfield which calls the omdbAPI to retrieve datasets * from the web service. @See MovieAutoComplete for more details. * @return FieldList */ public function getCMSFields() { $fields = parent::getCMSFields(); // Add Movie Fields to the Main tab in the edit form (before the content area) $fields->addFieldsToTab('Root.Main', array(HeaderField::create('Movies'), MovieAutoComplete::create("SearchTerm", "Search", "", 128)->setAttribute('placeholder', "Please enter a movie name to search for...")->setDescription('After choosing a movie, the details will be used as a template to complete this form.'), HeaderField::create('Movie Details', 'Movie Details', 3), TextField::create('MovieTitle', 'Movie Title', $this->Title), FieldGroup::create(array(TextField::create('Runtime', 'Runtime', $this->Runtime), TextField::create('Rated', 'Rated', $this->Rated)))->setTitle('Details'), FieldGroup::create(array(TextField::create('Country', 'Country', $this->Country), TextField::create('Released', 'Released', $this->Released), TextField::create('Year', 'Year', $this->Year)))->setTitle('Release Info'), TextField::create('Genre', 'Genre', $this->Genre), TextareaField::create('Plot', 'Plot', $this->Plot), HeaderField::create('People Involved', 'People Involved', 3), TextField::create('Director', 'Director', $this->Director), TextField::create('Writer', 'Writer', $this->Writer), TextField::create('Actors', 'Actors', $this->Actors), HeaderField::create('Awards', 'Awards', 3), TextareaField::create('Awards', 'Awards', $this->Awards), HiddenField::create('Type', 'Type', $this->Type), HiddenField::create('ImdbID', 'ImdbID', $this->ImdbID), HiddenField::create('ImdbRating', 'ImdbRating', $this->ImdbRating)), 'Content'); // Remove the content area (HTMLEditField) $fields->removeByName('Content'); return $fields; }
public function updateSettingsFields(FieldList $fields) { $message = '<p>Configure this page to use a timeline</p>'; $fields->addFieldToTab('Root.Settings', LiteralField::create("TimelineMessage", $message)); $timeline = FieldGroup::create(CheckboxField::create('ShowTimeline', 'Show a timeline on this page?'))->setTitle('Timeline'); $fields->addFieldToTab('Root.Settings', $timeline); if ($this->owner->ShowTimeline) { } }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeFieldsFromTab('Root.Main', array('SortOrder', 'Draft', 'PageID')); $fields->addFieldToTab("Root.Main", TextField::create("Title")->setTitle("Caption")); $fields->addFieldToTab("Root.Main", TextField::create("GoToURL")->setTitle("Go to URL")->setDescription("Start with http://")); $fields->addFieldToTab("Root.Main", FieldGroup::create(CheckboxField::create("Draft")->setTitle("Draft?"))->setTitle("Draft")); $fields->addFieldToTab("Root.Main", UploadField::create("Image")->setTitle("Image")->setFolderName("APSlideshow")->setConfig("allowedMaxFileNumber", 1)); return $fields; }
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')); } }
/** * Return field list for iframe insert/update form * * @see HtmlEditorField_Toolbar::getFieldsForOembed() */ protected function getFieldsForIframe($url, $file) { $thumbnailURL = FRAMEWORK_DIR . '/images/default_media.png'; $fields = new FieldList($filePreview = CompositeField::create(CompositeField::create(new LiteralField("ImageFull", "<img id='thumbnailImage' class='thumbnail-preview' " . "src='{$thumbnailURL}?r=" . rand(1, 100000) . "' alt='{$file->Name}' />\n"))->setName("FilePreviewImage")->addExtraClass('cms-file-info-preview'), CompositeField::create(CompositeField::create(new ReadonlyField("FileType", _t('AssetTableField.TYPE', 'File type') . ':', $file->Type), $urlField = ReadonlyField::create('ClickableURL', _t('AssetTableField.URL', 'URL'), sprintf('<a href="%s" target="_blank" class="file">%s</a>', $url, $url))->addExtraClass('text-wrap')))->setName("FilePreviewData")->addExtraClass('cms-file-info-data'))->setName("FilePreview")->addExtraClass('cms-file-info'), new TextField('CaptionText', _t('HtmlEditorField.CAPTIONTEXT', 'Caption text')), DropdownField::create('CSSClass', _t('HtmlEditorField.CSSCLASS', 'Alignment / style'), array('left' => _t('HtmlEditorField.CSSCLASSLEFT', 'On the left, with text wrapping around.'), 'leftAlone' => _t('HtmlEditorField.CSSCLASSLEFTALONE', 'On the left, on its own.'), 'right' => _t('HtmlEditorField.CSSCLASSRIGHT', 'On the right, with text wrapping around.'), 'center' => _t('HtmlEditorField.CSSCLASSCENTER', 'Centered, on its own.')))->addExtraClass('last')); if ($file->Width != null) { $fields->push(FieldGroup::create(_t('HtmlEditorField.IMAGEDIMENSIONS', 'Dimensions'), TextField::create('Width', _t('HtmlEditorField.IMAGEWIDTHPX', 'Width'), $file->Width)->setMaxLength(5), TextField::create('Height', _t('HtmlEditorField.IMAGEHEIGHTPX', 'Height'), $file->Height)->setMaxLength(5))->addExtraClass('dimensions last')); } $urlField->dontEscape = true; $fields->push(new HiddenField('URL', false, $url)); 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')); } }
/** * @param FieldSet $fields */ public function updateCMSFields(FieldList $fields) { $fields->findOrMakeTab('Root.Schedule', _t('ScheduledExecution.ScheduleTabTitle', 'Schedule')); $fields->addFieldsToTab('Root.Schedule', array($dt = new Datetimefield('FirstExecution', _t('ScheduledExecution.FIRST_EXECUTION', 'First Execution')), FieldGroup::create(new NumericField('ExecuteInterval', ''), new DropdownField('ExecuteEvery', '', array('' => '', 'Minute' => _t('ScheduledExecution.ExecuteEveryMinute', 'Minute'), 'Hour' => _t('ScheduledExecution.ExecuteEveryHour', 'Hour'), 'Day' => _t('ScheduledExecution.ExecuteEveryDay', 'Day'), 'Week' => _t('ScheduledExecution.ExecuteEveryWeek', 'Week'), 'Fortnight' => _t('ScheduledExecution.ExecuteEveryFortnight', 'Fortnight'), 'Month' => _t('ScheduledExecution.ExecuteEveryMonth', 'Month'), 'Year' => _t('ScheduledExecution.ExecuteEveryYear', 'Year'))))->setTitle(_t('ScheduledExecution.EXECUTE_EVERY', 'Execute every')), new TextField('ExecuteFree', _t('ScheduledExecution.EXECUTE_FREE', 'Scheduled (in strtotime format from first execution)')))); if ($this->owner->ScheduledJobID) { $jobTime = $this->owner->ScheduledJob()->StartAfter; $fields->addFieldsToTab('Root.Schedule', array(new ReadonlyField('NextRunDate', _t('ScheduledExecution.NEXT_RUN_DATE', 'Next run date'), $jobTime))); } $dt->getDateField()->setConfig('showcalendar', true); $dt->getTimeField()->setConfig('showdropdown', true); }
/** * 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; }
/** * Gets the fields for displaying in the cms * @param {string} $url Vidyard Video URL * @param {VidyardInsertMedia_Embed} $file Vidyard Insert Media Embed Object * @return {FieldList} Field List of fields used in the cms */ protected function getFieldsForVidyard($url, VidyardInsertMedia_Embed $file) { $thumbnailURL = Convert::raw2att($file->Oembed->thumbnail_url); $fileName = Convert::raw2att($file->Name); $fields = new FieldList($filePreview = CompositeField::create(CompositeField::create(new LiteralField("ImageFull", "<img id='thumbnailImage' class='thumbnail-preview' " . "src='{$thumbnailURL}?r=" . rand(1, 100000) . "' alt='{$fileName}' />\n"))->setName("FilePreviewImage")->addExtraClass('cms-file-info-preview'), CompositeField::create(CompositeField::create(new ReadonlyField("FileType", _t('AssetTableField.TYPE', 'File type') . ':', $file->Type), $urlField = ReadonlyField::create('ClickableURL', _t('AssetTableField.URL', 'URL'), sprintf('<a href="%s" target="_blank" class="file">%s</a>', Convert::raw2att($url), Convert::raw2att($url)))->addExtraClass('text-wrap')))->setName("FilePreviewData")->addExtraClass('cms-file-info-data'))->setName("FilePreview")->addExtraClass('cms-file-info'), DropdownField::create('CSSClass', _t('HtmlEditorField.CSSCLASS', 'Alignment / style'), array('leftAlone' => _t('HtmlEditorField.CSSCLASSLEFTALONE', 'On the left, on its own.'), 'center' => _t('HtmlEditorField.CSSCLASSCENTER', 'Centered, on its own.'), 'left' => _t('HtmlEditorField.CSSCLASSLEFT', 'On the left, with text wrapping around.'), 'right' => _t('HtmlEditorField.CSSCLASSRIGHT', 'On the right, with text wrapping around.')))->addExtraClass('last'), new CheckboxField('UseLightbox', _t('VidyardInsertMedia.USE_LIGHTBOX', '_Use the Lightbox Display'))); if ($file->Width != null) { $fields->push(FieldGroup::create(_t('HtmlEditorField.IMAGEDIMENSIONS', 'Dimensions'), TextField::create('Width', _t('HtmlEditorField.IMAGEWIDTHPX', 'Width'), $file->InsertWidth)->setMaxLength(5), TextField::create('Height', _t('HtmlEditorField.IMAGEHEIGHTPX', 'Height'), $file->InsertHeight)->setMaxLength(5))->addExtraClass('dimensions last')); } $urlField->dontEscape = true; $fields->push(new HiddenField('URL', false, $file->getURL())); return $fields; }
/** * Updates the CMS fields of the extended object. * * @param FieldList $fields */ public function updateCMSFields(FieldList $fields) { // Create Moderno Tab Set: $fields->addFieldToTab('Root', TabSet::create('Moderno', _t('ModernoConfigExtension.MODERNO', 'Moderno'))); // Create Colors Tab: $fields->findOrMakeTab('Root.Moderno.Colors', _t('ModernoConfigExtension.COLORS', 'Colors')); // Create Colors Fields: $fields->addFieldsToTab('Root.Moderno.Colors', array(ColorField::create('ModernoHighlightColor', _t('ModernoConfigExtension.HIGHLIGHTCOLOR', 'Highlight color')), ColorField::create('ModernoLogoBkgColor', _t('ModernoConfigExtension.LOGOBACKGROUNDCOLOR', 'Logo background color')), ColorField::create('ModernoLinkColor', _t('ModernoConfigExtension.LINKCOLOR', 'Link color')), ColorField::create('ModernoProfileLinkColor', _t('ModernoConfigExtension.PROFILELINKCOLOR', 'Profile link color')))); // Create Branding Tab: $fields->findOrMakeTab('Root.Moderno.Branding', _t('ModernoConfigExtension.BRANDING', 'Branding')); // Create Branding Fields: $fields->addFieldsToTab('Root.Moderno.Branding', array(TextField::create('ModernoApplicationName', _t('ModernoConfigExtension.APPLICATIONNAME', 'Application name')), TextField::create('ModernoApplicationLink', _t('ModernoConfigExtension.APPLICATIONLINK', 'Application link')), ToggleCompositeField::create('ModernoLogoToggle', _t('ModernoConfigExtension.LOGOIMAGETOGGLETITLE', 'Logo Image'), array(UploadField::create('ModernoLogoImage', _t('ModernoConfigExtension.LOGOIMAGE', 'Logo image'))->setAllowedFileCategories('image')->setFolderName(self::get_asset_path()), FieldGroup::create(_t('ModernoConfigExtension.DIMENSIONSINPIXELS', 'Dimensions (in pixels)'), array(TextField::create('ModernoLogoImageWidth', '')->setAttribute('placeholder', _t('ModernoConfigExtension.WIDTH', 'Width')), LiteralField::create('ModernoLogoImageBy', '<i class="fa fa-times by"></i>'), TextField::create('ModernoLogoImageHeight', '')->setAttribute('placeholder', _t('ModernoConfigExtension.HEIGHT', 'Height')))), DropdownField::create('ModernoLogoImageResize', _t('ModernoConfigExtension.RESIZEMETHOD', 'Resize method'), self::get_resize_methods())->setEmptyString(' '), CheckboxField::create('ModernoHideSiteName', _t('ModernoConfigExtension.HIDESITENAME', 'Hide site name')), CheckboxField::create('ModernoSupportRetina', _t('ModernoConfigExtension.SUPPORTRETINADEVICES', 'Support Retina devices')))), ToggleCompositeField::create('ModernoLoadingToggle', _t('ModernoConfigExtension.LOADINGIMAGETOGGLETITLE', 'Loading Image'), array(UploadField::create('ModernoLoadingImage', _t('ModernoConfigExtension.LOADINGIMAGE', 'Loading image'))->setAllowedFileCategories('image')->setFolderName(self::get_asset_path()), FieldGroup::create(_t('ModernoConfigExtension.DIMENSIONSINPIXELS', 'Dimensions (in pixels)'), array(TextField::create('ModernoLoadingImageWidth', '')->setAttribute('placeholder', _t('ModernoConfigExtension.WIDTH', 'Width')), LiteralField::create('ModernoLoadingImageBy', '<i class="fa fa-times by"></i>'), TextField::create('ModernoLoadingImageHeight', '')->setAttribute('placeholder', _t('ModernoConfigExtension.HEIGHT', 'Height')))), DropdownField::create('ModernoLoadingImageResize', _t('ModernoConfigExtension.RESIZEMETHOD', 'Resize method'), self::get_resize_methods())->setEmptyString(' '))))); }
public function updateSettingsFields(FieldList $fields) { // Present a set of checkboxes for filtering this item by locale $menuFilterField = FieldGroup::create()->setTitle($this->owner->fieldLabel('ShowInMenus'))->setDescription(_t('Fluent.LocaleMenuFilterDescription', 'Select the locales where this item is visible in the menu')); foreach (Fluent::locales() as $locale) { $id = Fluent::db_field_for_locale("ShowInMenus", $locale); $fields->removeByName($id, true); // Remove existing (in case it was auto scaffolded) $title = i18n::get_locale_name($locale); $menuFilterField->push(new CheckboxField($id, $title)); } $fields->removeByName('ShowInMenus', true); $fields->addFieldToTab('Root.Settings', $menuFilterField, 'CanViewType'); }
public function __construct($controller, $name, $order) { /* Fields */ $fields = FieldList::create(ReadonlyField::create("Shipping", "Shipping Total (" . Product::getDefaultCurrency() . ")", $shipping_total = Order::create()->calculateShippingTotal($order->ID, $order->Courier)), FieldGroup::create("Tax (" . Product::getDefaultCurrency() . ")", ReadonlyField::create("ProductTaxInclusive", "Product Tax (Inclusive)", Order::create()->calculateProductTax(1, $order))->setRightTitle("Basket total is inclusive of this tax."), ReadonlyField::create("ProductTaxExclusive", "Product Tax (Exclusive)", $exc_product_tax = Order::create()->calculateProductTax(2, $order))->setRightTitle("Basket total is exclusive of this tax."), ReadonlyField::create("ShippingTax", "Shipping Tax", $shipping_tax = Order::create()->calculateShippingTax(Order::create()->calculateShippingTotal($order->ID, $order->Courier), $order))->setRightTitle(StoreSettings::get_settings()->TaxSettings_ShippingInclusiveExclusive == 1 ? "Shipping price is inclusive of this tax." : "Shipping price is exclusive of this tax.")), ReadonlyField::create("Total", "Final Total", Order::create()->calculateOrderTotal($order))); /* Actions */ $actions = FieldList::create(); /* Required Fields */ $required = new RequiredFields(array()); /* * Now we create the actual form with our fields and actions defined * within this class. */ return parent::__construct($controller, $name, $fields, $actions, $required); }
public function updateSettingsFields(FieldList $fields) { // Produce following message by default $message = '<p>' . _t('CarouselPage.DISPLAYCAROUSELONTHISPAGE', 'Display carousel on this page') . '</p>'; $fields->addFieldToTab('Root.Settings', LiteralField::create("CarouselMessage", $message)); // Display option to request carousel on settings tab $carousel = FieldGroup::create(CheckboxField::create('ShowCarousel', _t('CarouselPage.ADDCAROUSEL', 'Add carousel to this page?')))->setTitle(_t('CarouselPage.TITLE', 'Carousel')); $fields->addFieldToTab('Root.Settings', $carousel); // If user selects to add carousel add additional settings if ($this->owner->ShowCarousel) { $fields->addFieldToTab('Root.Settings', NumericField::create('CarouselWidth', _t('CarouselPage.WIDTH', 'Width'))); $fields->addFieldToTab('Root.Settings', NumericField::create('CarouselHeight', _t('CarouselPage.HEIGHT', 'Height'))); } }
function getCMSFields() { $fields = parent::getCMSFields(); $description = 'This is <strong>bold</strong> help text'; $fields->addFieldsToTab('Root.Text', array(Object::create('TextField', 'Required', 'Required field'), Object::create('TextField', 'Validated', 'Validated field (checks range between 1 and 3)'), Object::create('ReadonlyField', 'Readonly', 'ReadonlyField'), Object::create('TextareaField', 'Textarea', 'TextareaField - 8 rows')->setRows(8), Object::create('TextField', 'Text', 'TextField'), Object::create('HtmlEditorField', 'HTMLField', 'HtmlEditorField'), Object::create('EmailField', 'Email', 'EmailField'), Object::create('PasswordField', 'Password', 'PasswordField'))); $fields->addFieldsToTab('Root.Numeric', array(Object::create('NumericField', 'Number', 'NumericField'), Object::create('CurrencyField', 'Price', 'CurrencyField'), Object::create('MoneyField', 'Money', 'MoneyField', array('Amount' => 99.98999999999999, 'Currency' => 'EUR')), Object::create('PhoneNumberField', 'PhoneNumber', 'PhoneNumberField'), Object::create('CreditCardField', 'CreditCard', 'CreditCardField'))); $fields->addFieldsToTab('Root.Option', array(Object::create('CheckboxField', 'Checkbox', 'CheckboxField'), Object::create('CheckboxSetField', 'CheckboxSet', 'CheckboxSetField', TestCategory::map()), Object::create('DropdownField', 'DropdownID', 'DropdownField', TestCategory::map())->setHasEmptyDefault(true), Object::create('GroupedDropdownField', 'GroupedDropdownID', 'GroupedDropdown', array('Test Categorys' => TestCategory::map())), Object::create('ListboxField', 'ListboxFieldID', 'ListboxField', TestCategory::map())->setSize(3), Object::create('ListboxField', 'MultipleListboxFieldID', 'ListboxField (multiple)', TestCategory::map())->setMultiple(true)->setSize(3), Object::create('OptionsetField', 'OptionSet', 'OptionSetField', TestCategory::map()), Object::create('ToggleCompositeField', 'ToggleCompositeField', 'ToggleCompositeField', new FieldList(Object::create('TextField', 'ToggleCompositeTextField1'), Object::create('TextField', 'ToggleCompositeTextField2'), Object::create('DropdownField', 'ToggleCompositeDropdownField', 'ToggleCompositeDropdownField', TestCategory::map()), Object::create('TextField', 'ToggleCompositeTextField3'))))); // All these date/time fields generally have issues saving directly in the CMS $fields->addFieldsToTab('Root.DateTime', array($calendarDateField = Object::create('DateField', 'CalendarDate', 'DateField with calendar'), Object::create('DateField', 'Date', 'DateField'), $dmyDateField = Object::create('DateField', 'DMYDate', 'DateField with separate fields'), Object::create('TimeField', 'Time', 'TimeField'), $timeFieldDropdown = Object::create('TimeField', 'TimeWithDropdown', 'TimeField with dropdown'), Object::create('DatetimeField', 'DateTime', 'DateTime'), $dateTimeShowCalendar = Object::create('DatetimeField', 'DateTimeWithCalendar', 'DateTime with calendar'))); $calendarDateField->setConfig('showcalendar', true); $dmyDateField->setConfig('dmyfields', true); $timeFieldDropdown->setConfig('showdropdown', true); $dateTimeShowCalendar->getDateField()->setConfig('showcalendar', true); $dateTimeShowCalendar->getTimeField()->setConfig('showdropdown', true); $fields->addFieldsToTab('Root.File', array($bla = UploadField::create('File', 'FileUploadField')->setDescription($description)->setConfig('allowedMaxFileNumber', 1)->setConfig('canPreviewFolder', false), UploadField::create('AttachedFile', 'UploadField with canUpload=false')->setDescription($description)->setConfig('canUpload', false), UploadField::create('Image', 'UploadField for image')->setDescription($description), UploadField::create('HasManyFiles', 'UploadField for has_many')->setDescription($description), UploadField::create('ManyManyFiles', 'UploadField for many_many')->setDescription($description))); $data = $this->getDefaultData(); foreach ($fields->dataFields() as $field) { $name = $field->getName(); if (isset($data[$name])) { $field->setValue($data[$name]); } } $blacklist = array('DMYDate', 'Required', 'Validated', 'ToggleCompositeField'); $tabs = array('Root.Text', 'Root.Numeric', 'Root.Option', 'Root.DateTime', 'Root.File'); foreach ($tabs as $tab) { $tabObj = $fields->fieldByName($tab); foreach ($tabObj->FieldList() as $field) { $field->setDescription($description); // ->addExtraClass('cms-description-tooltip'); if (in_array($field->getName(), $blacklist)) { continue; } $disabledField = $field->performDisabledTransformation(); $disabledField->setTitle($disabledField->Title() . ' (disabled)'); $disabledField->setName($disabledField->getName() . '_disabled'); $tabObj->insertAfter($disabledField, $field->getName()); $readonlyField = $field->performReadonlyTransformation(); $readonlyField->setTitle($readonlyField->Title() . ' (readonly)'); $readonlyField->setName($readonlyField->getName() . '_readonly'); $tabObj->insertAfter($readonlyField, $field->getName()); } } $noLabelField = new TextField('Text_NoLabel', false, 'TextField without label'); $noLabelField->setDescription($description); $fields->addFieldToTab('Root.Text', $noLabelField, 'Text_disabled'); $fields->addFieldToTab('Root.Text', FieldGroup::create(TextField::create('MyFieldGroup1'), TextField::create('MyFieldGroup2'), DropdownField::create('MyFieldGroup3', false, TestCategory::map()))); $fields->addFieldToTab('Root.Text', FieldGroup::create('MyLabelledFieldGroup', array(TextField::create('MyLabelledFieldGroup1'), TextField::create('MyLabelledFieldGroup2'), DropdownField::create('MyLabelledFieldGroup3', null, TestCategory::map())))->setTitle('My Labelled Field Group')); return $fields; }
/** * Restrict access for CMS users editing search suggestions. */ public function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeByName('ExtensibleSearchPageID'); // Make sure the search suggestions and frequency are read only. if ($this->Term) { $fields->makeFieldReadonly('Term'); } $fields->removeByName('Frequency'); // Update the approved flag positioning. $fields->removeByName('Approved'); $fields->addFieldToTab('Root.Main', $approved = FieldGroup::create('Approved?')->addExtraClass('approved wrapper')); $approved->push($this->getApprovedField()); return $fields; }