/** * 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 Order Status"), CompositeField::create(TextField::create("Title", "Friendly Name")->setRightTitle("The name of your custom order status. i.e. Pending, Awaiting Stock."), TextareaField::create("Content", "Friendly Description")->setRightTitle("This will be shown to your customers. What do you wish to tell them about this status?"))))); return $fields; }
public function AddNewListboxForm() { $action = FormAction::create('doSave', 'Save')->setUseButtonTag('true'); if (!$this->isFrontend) { $action->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept'); } $model = $this->getModel(); $link = singleton($model); $fields = $link->getCMSFields(); $title = $this->getDialogTitle() ? $this->getDialogTitle() : 'New Item'; $fields->insertBefore(HeaderField::create('AddNewHeader', $title), $fields->first()->getName()); $actions = FieldList::create($action); $form = Form::create($this, 'AddNewListboxForm', $fields, $actions); $fields->push(HiddenField::create('model', 'model', $model)); /* if($link){ $form->loadDataFrom($link); $fields->push(HiddenField::create('LinkID', 'LinkID', $link->ID)); } // Chris Bolt, fixed this //$this->owner->extend('updateLinkForm', $form); $this->extend('updateLinkForm', $form); // End Chris Bolt */ return $form; }
public function getCMSFields() { $DefaultAlbumCoverField = UploadField::create('DefaultAlbumCover'); $DefaultAlbumCoverField->folderName = "PhotoGallery"; $DefaultAlbumCoverField->getValidator()->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png'); $fields = parent::getCMSFields(); $AlbumsGridField = new GridField("PhotoAlbums", "Album", $this->PhotoAlbums(), GridFieldConfig::create()->addComponent(new GridFieldToolbarHeader())->addComponent(new GridFieldAddNewButton('toolbar-header-right'))->addComponent(new GridFieldSortableHeader())->addComponent(new GridFieldDataColumns())->addComponent(new GridFieldPaginator(50))->addComponent(new GridFieldEditButton())->addComponent(new GridFieldDeleteAction())->addComponent(new GridFieldDetailForm())->addComponent(new GridFieldFilterHeader())->addComponent($sortable = new GridFieldSortableRows('SortID'))); if ($this->AlbumDefaultTop == true) { $sortable->setAppendToTop(true); } $fields->addFieldToTab("Root.Albums", $AlbumsGridField); $fields->addFieldToTab("Root.Config", HeaderField::create("Album Settings")); $fields->addFieldToTab("Root.Config", $DefaultAlbumCoverField); $fields->addFieldToTab("Root.Config", SliderField::create('AlbumsPerPage', 'Number of Albums Per Page', 1, 25)); $fields->addFieldToTab("Root.Config", SliderField::create("AlbumThumbnailWidth", "Album Cover Thumbnail Width", 50, 400)); $fields->addFieldToTab("Root.Config", SliderField::create("AlbumThumbnailHeight", "Album Cover Thumbnail Height", 50, 400)); $fields->addFieldToTab("Root.Config", CheckboxField::create("ShowAllPhotoAlbums")->setTitle("Show photo album even if it's empty")); $fields->addFieldToTab("Root.Config", CheckboxField::create("AlbumDefaultTop")->setTitle("Sort new albums to the top by default")); $fields->addFieldToTab("Root.Config", HeaderField::create("Photo Settings")); $fields->addFieldToTab("Root.Config", SliderField::create("PhotosPerPage", "Number of Photos Per Page", 1, 50)); $fields->addFieldToTab("Root.Config", SliderField::create("PhotoThumbnailWidth", "Photo Thumbnail Width", 50, 400)); $fields->addFieldToTab("Root.Config", SliderField::create("PhotoThumbnailHeight", "Photo Thumbnail Height", 50, 400)); $fields->addFieldToTab("Root.Config", SliderField::create("PhotoFullWidth", "Photo Fullsize Width", 400, 1200)); $fields->addFieldToTab("Root.Config", SliderField::create("PhotoFullHeight", "Photo Fullsize Height", 400, 1200)); $fields->addFieldToTab("Root.Config", CheckboxField::create("PhotoDefaultTop")->setTitle("Sort new photos to the top by default")); 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; }
/** * The LinkForm for the dialog window * * @return Form **/ public function LinkForm() { $link = $this->getLinkObject(); $action = FormAction::create('doSaveLink', _t('Linkable.SAVE', 'Save'))->setUseButtonTag('true'); if (!$this->isFrontend) { $action->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept'); } $link = null; if ($linkID = (int) $this->request->getVar('LinkID')) { $link = Link::get()->byID($linkID); } $link = $link ? $link : singleton('Link'); $link->setAllowedTypes($this->getAllowedTypes()); $fields = $link->getCMSFields(); $title = $link ? _t('Linkable.EDITLINK', 'Edit Link') : _t('Linkable.ADDLINK', 'Add Link'); $fields->insertBefore(HeaderField::create('LinkHeader', $title), _t('Linkable.TITLE', 'Title')); $actions = FieldList::create($action); $form = Form::create($this, 'LinkForm', $fields, $actions); if ($link) { $form->loadDataFrom($link); $fields->push(HiddenField::create('LinkID', 'LinkID', $link->ID)); } $this->owner->extend('updateLinkForm', $form); return $form; }
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; }
/** * @param FieldList $fields */ public function updateCMSFields(FieldList $fields) { Requirements::add_i18n_javascript(ADVANCED_WORKFLOW_DIR . '/javascript/lang'); // Add timepicker functionality // @see https://github.com/trentrichardson/jQuery-Timepicker-Addon Requirements::css(ADVANCED_WORKFLOW_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-timepicker-addon.css'); Requirements::css(ADVANCED_WORKFLOW_DIR . '/css/WorkflowCMS.css'); Requirements::javascript(ADVANCED_WORKFLOW_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-sliderAccess.js'); Requirements::javascript(ADVANCED_WORKFLOW_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-timepicker-addon.js'); Requirements::javascript(ADVANCED_WORKFLOW_DIR . '/javascript/WorkflowField.js'); $this->setIsWorkflowInEffect(); $fields->findOrMakeTab('Root.PublishingSchedule', _t('WorkflowEmbargoExpiryExtension.TabTitle', 'Publishing Schedule')); if ($this->getIsWorkflowInEffect()) { $fields->addFieldsToTab('Root.PublishingSchedule', array(HeaderField::create('PublishDateHeader', _t('WorkflowEmbargoExpiryExtension.REQUESTED_PUBLISH_DATE_H3', 'Expiry and Embargo'), 3), LiteralField::create('PublishDateIntro', $this->getIntroMessage('PublishDateIntro')), $dt = Datetimefield::create('DesiredPublishDate', _t('WorkflowEmbargoExpiryExtension.REQUESTED_PUBLISH_DATE', 'Requested publish date')), $ut = Datetimefield::create('DesiredUnPublishDate', _t('WorkflowEmbargoExpiryExtension.REQUESTED_UNPUBLISH_DATE', 'Requested un-publish date')), Datetimefield::create('PublishOnDate', _t('WorkflowEmbargoExpiryExtension.PUBLISH_ON', 'Scheduled publish date'))->setDisabled(true), Datetimefield::create('UnPublishOnDate', _t('WorkflowEmbargoExpiryExtension.UNPUBLISH_ON', 'Scheduled un-publish date'))->setDisabled(true))); } else { $fields->addFieldsToTab('Root.PublishingSchedule', array(HeaderField::create('PublishDateHeader', _t('WorkflowEmbargoExpiryExtension.REQUESTED_PUBLISH_DATE_H3', 'Expiry and Embargo'), 3), LiteralField::create('PublishDateIntro', $this->getIntroMessage('PublishDateIntro')), $dt = Datetimefield::create('PublishOnDate', _t('WorkflowEmbargoExpiryExtension.PUBLISH_ON', 'Scheduled publish date')), $ut = Datetimefield::create('UnPublishOnDate', _t('WorkflowEmbargoExpiryExtension.UNPUBLISH_ON', 'Scheduled un-publish date')))); } $dt->getDateField()->setConfig('showcalendar', true); $ut->getDateField()->setConfig('showcalendar', true); $dt->getTimeField()->setConfig('timeformat', 'HH:mm:ss'); $ut->getTimeField()->setConfig('timeformat', 'HH:mm:ss'); // Enable a jQuery-UI timepicker widget if (self::$showTimePicker) { $dt->getTimeField()->addExtraClass('hasTimePicker'); $ut->getTimeField()->addExtraClass('hasTimePicker'); } }
public function getCMSFields() { $fields = new FieldList(); $fields->push(new TabSet("Root", new Tab("Main", HeaderField::create("Application Settings", 3), TextField::create("FacebookConsumerKey", "Consumer Key"), PasswordField::create("FacebookConsumerSecret", "Consumer Secret"), OptionsetField::create("EnableFacebookLogin", "Facebook Login", array(0 => "Disabled", 1 => "Enabled")), OptionsetField::create("EnableFacebookSignup", "Facebook Signup", array(0 => "Disabled", 1 => "Enabled"))))); $this->extend("updateCMSFields", $fields); return $fields; }
public function __construct($controller, $name, Order $order) { $this->order = $order; $fields = FieldList::create(HiddenField::create('OrderID', '', $order->ID)); $actions = FieldList::create(); //payment if (self::config()->allow_paying && $order->canPay()) { $gateways = GatewayInfo::get_supported_gateways(); //remove manual gateways foreach ($gateways as $gateway => $gatewayname) { if (GatewayInfo::is_manual($gateway)) { unset($gateways[$gateway]); } } if (!empty($gateways)) { $fields->push(HeaderField::create("MakePaymentHeader", _t("OrderActionsForm.MAKEPAYMENT", "Make Payment"))); $outstandingfield = Currency::create(); $outstandingfield->setValue($order->TotalOutstanding()); $fields->push(LiteralField::create("Outstanding", sprintf(_t("OrderActionsForm.OUTSTANDING", "Outstanding: %s"), $outstandingfield->Nice()))); $fields->push(OptionsetField::create('PaymentMethod', _t("OrderActionsForm.PAYMENTMETHOD", "Payment Method"), $gateways, key($gateways))); $actions->push(FormAction::create('dopayment', _t('OrderActionsForm.PAYORDER', 'Pay outstanding balance'))); } } //cancelling if (self::config()->allow_cancelling && $order->canCancel()) { $actions->push(FormAction::create('docancel', _t('OrderActionsForm.CANCELORDER', 'Cancel this order'))); } parent::__construct($controller, $name, $fields, $actions); $this->extend("updateForm", $order); }
/** * 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 Tax Class"), CompositeField::create(TextField::create("Title", "Class Name")->setRightTitle("i.e. Zero Rate, Standard Rate."))))); return $fields; }
public function updateCMSFields(FieldList $fields) { // Use SortableUploadField instead of UploadField! $imagesTab = $fields->findOrMakeTab('Root.Images'); $owner = $this->owner; if ($owner::config()->allow_images) { $limit = $owner::config()->images_count; $uploadClass = class_exists("SortableUploadField") && $this->owner->Sorter == "SortOrder" ? "SortableUploadField" : "UploadField"; $imageField = $uploadClass::create('Images'); $imageField->setConfig('allowedMaxFileNumber', $limit); $imageField->setFolderName('Uploads/' . $this->owner->ClassName . '/' . $this->owner->ID); if ($limit == 1) { $imagesTab->setTitle(_t("Object.IMAGETAB", "Images")); $imageField->setTitle(_t("Object.IMAGEUPLOADLABEL", "Image")); } else { $imagesTab->setTitle(_t("Object.IMAGESTAB", "Images")); $imageField->setTitle(_t("Object.IMAGESUPLOADLABEL", "Images")); $imageField->setDescription(sprintf(_t("Object.IMAGESUPLOADLIMIT", "Images count limit: %s"), $limit)); if ($this->owner->Sorter == "SortOrder") { $message = class_exists("SortableUploadField") ? _t("Object.IMAGESUPLOADHEADING", "<span style='color: green'>Sort images by draging thumbnail</span>") : _t("Object.IMAGESUPLOADHEADINGWRONG", "<span style='color: red'>Sorting images by draging thumbnails (SortOrder) not allowed. Missing module SortabeUploadField.</span>"); } else { $message = _t("Object.IMAGESSORTERNOTICE", "Correct image sorting is visible on frontend only (if Sort by = Title, ID)"); } $dropdownSorter = DropdownField::create('Sorter', _t("Object.IMAGESSORTER", "Sort images by: "))->setSource($this->owner->dbObject('Sorter')->enumValues()); $fields->addFieldToTab('Root.Images', $dropdownSorter); $fields->addFieldToTab('Root.Images', HeaderField::create('ImagesNotice', $message)->setHeadingLevel(4)); } $fields->addFieldToTab('Root.Images', $imageField); } else { $fields->removeByName($imagesTab->Name); } }
/** * 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 Tax Zone"), CompositeField::create(DropdownField::create("Enabled", "Enable this zone?", array("1" => "Yes", "2" => "No"))->setRightTitle($this->SystemCreated == 1 && $this->exists() ? "DISABLED: You can not disable the default tax zone." : "If enabled your store will use the rates defined in this zone for customers in the selected country.")->setDisabled($this->SystemCreated == 1 && $this->exists() ? true : false), !$this->exists() ? CountryDropdownField::create("Title", "Country")->setRightTitle($this->SystemCreated == 1 && $this->exists() ? "DISABLED: You can not select a country as this zone applies to all countries." : "Select the country this zone applies to.")->setDisabled($this->SystemCreated == 1 && $this->exists() ? true : false) : "", $this->exists() ? GridField::create("TaxZones_TaxRates", "Tax Rates within the '" . $this->Title . "' Tax Zone", $this->TaxRates(), GridFieldConfig_RecordEditor::create()) : "")))); return $fields; }
public function __construct($controller, $name = "PostagePaymentForm") { // Get delivery data and postage areas from session $delivery_data = Session::get("Commerce.DeliveryDetailsForm.data"); $country = $delivery_data['DeliveryCountry']; $postcode = $delivery_data['DeliveryPostCode']; $postage_areas = $controller->getPostageAreas($country, $postcode); // Loop through all postage areas and generate a new list $postage_array = array(); foreach ($postage_areas as $area) { $area_currency = new Currency("Cost"); $area_currency->setValue($area->Cost); $postage_array[$area->ID] = $area->Title . " (" . $area_currency->Nice() . ")"; } $postage_id = Session::get('Commerce.PostageID') ? Session::get('Commerce.PostageID') : 0; // Setup postage fields $postage_field = CompositeField::create(HeaderField::create("PostageHeader", _t('Commerce.Postage', "Postage")), OptionsetField::create("PostageID", _t('Commerce.PostageSelection', 'Please select your prefered postage'), $postage_array)->setValue($postage_id))->setName("PostageFields")->addExtraClass("unit")->addExtraClass("size1of2")->addExtraClass("unit-50"); // Get available payment methods and setup payment $payment_methods = SiteConfig::current_site_config()->PaymentMethods(); // Deal with payment methods if ($payment_methods->exists()) { $payment_map = $payment_methods->map('ID', 'Label'); $payment_value = $payment_methods->filter('Default', 1)->first()->ID; } else { $payment_map = array(); $payment_value = 0; } $payment_field = CompositeField::create(HeaderField::create('PaymentHeading', _t('Commerce.Payment', 'Payment'), 2), OptionsetField::create('PaymentMethodID', _t('Commerce.PaymentSelection', 'Please choose how you would like to pay'), $payment_map, $payment_value))->setName("PaymentFields")->addExtraClass("unit")->addExtraClass("size1of2")->addExtraClass("unit-50"); $fields = FieldList::create(CompositeField::create($postage_field, $payment_field)->setName("PostagePaymentFields")->addExtraClass("units-row")->addExtraClass("line")); $back_url = $controller->Link("billing"); $actions = FieldList::create(LiteralField::create('BackButton', '<a href="' . $back_url . '" class="btn btn-red commerce-action-back">' . _t('Commerce.Back', 'Back') . '</a>'), FormAction::create('doContinue', _t('Commerce.PaymentDetails', 'Enter Payment Details'))->addExtraClass('btn')->addExtraClass('commerce-action-next')->addExtraClass('btn-green')); $validator = RequiredFields::create(array("PostageID", "PaymentMethod")); parent::__construct($controller, $name, $fields, $actions, $validator); }
public function getCMSFields() { Requirements::css('widgetify/css/widgetify_cms.css'); Requirements::javascript('framework/thirdparty/jquery/jquery.js'); Requirements::javascript('widgetify/scripts/widgetify_page.js'); $fields = parent::getCMSFields(); $fields->push(HiddenField::create('WidgetifyContent', 'WidgetifyContent')); $fields->push(HiddenField::create('ThisID', 'ThisID', $this->ID)); $tab = $fields->findOrMakeTab('Root.Main'); $tab->insertAfter(HeaderField::create('WidgetifyTitle', 'Widgetify Template', 3), 'Metadata'); if (!$this->WidgetifyTemplateID) { $this->WidgetifyTemplateID = 0; } $templatesMap = DataList::create('WidgetifyTemplate')->map(); $tab->insertAfter(DropdownField::create('WidgetifyTemplateID', 'Select Template', $templatesMap)->setEmptyString('- Select -'), 'WidgetifyTitle'); $tab->insertAfter(CheckboxField::create('CSSFrontend', 'Apply template Stylesheet to front-end page'), 'WidgetifyTemplateID'); $tab->insertAfter(CheckboxField::create('JSFrontend', 'Apply template Javascript to front-end page'), 'CSSFrontend'); $tab->insertAfter(HeaderField::create('WidgetifyPreviewTitle', 'Widgetify Content', 3), 'JSFrontend'); $tab->insertAfter(LiteralField::create('WidgetifyPreview', '<div id="widgetifyPreview" class="widgetifyTemplate"></div>'), 'WidgetifyPreviewTitle'); $htmlField = HtmlEditorField::create('WidgetDynamicContent', false); $editorFieldContents = ' <div id="WidgetDynamicContentHolder" class="WidgetDynamicContentHolder"> <p id="edit-widget-title">Edit content</p>' . $htmlField->forTemplate() . ' <p class="widget-edit-actions"> <a href="javascript:;" id="save-widget-content" class="ss-ui-action-constructive ss-ui-button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary">Update</a> <a href="javascript:;" id="cancel-widget-content" class="ss-ui-action-destructive ui-button ui-widget ui-state-default ui-button-text-icon-primary ui-corner-left ss-ui-button">Cancel</a> </p> </div>'; $tab->insertAfter(LiteralField::create('WidgetDynamicContentPlaceHolder', $editorFieldContents), 'WidgetifyPreview'); $fields->removeFieldFromTab('Root.Main', 'Content'); return $fields; }
function getModularCMSFields($relationName = 'Modules', $title = 'Content Modules') { $fields = array(); $GLOBALS['_CONTENT_MODULE_PARENT_PAGEID'] = $this->owner->ID; $area = $this->owner->obj($relationName); if ($area && $area->exists()) { $fields[] = HeaderField::create($relationName . 'Header', $title, 2); $fields[] = GridField::create($relationName, $title, $area->Modules(), GridFieldConfig_RecordEditor::create()->addComponent(new GridFieldOrderableRows('SortOrder'))->removeComponentsByType('GridFieldAddNewButton')->addComponent($add = new GridFieldAddNewMultiClass())); if (($allowed_modules = $this->owner->Config()->get('allowed_modules')) && is_array($allowed_modules) && count($allowed_modules)) { if (isset($allowed_modules[$relationName])) { $add->setClasses($allowed_modules[$relationName]); } else { $add->setClasses($allowed_modules); } } else { // Remove the base "ContentModule" from allowed modules. $classes = array_values(ClassInfo::subclassesFor('ContentModule')); sort($classes); if (($key = array_search('ContentModule', $classes)) !== false) { unset($classes[$key]); } $add->setClasses($classes); } } else { $fields[] = LiteralField::create('SaveFirstToAddModules', '<div class="message">You must save first before you can add modules.</div>'); } return $fields; }
/** * 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($this->SystemName), CompositeField::create(TextField::create("Title", "Friendly Name")->setRightTitle("This is the name your customers would see against this courier."), DropdownField::create("Enabled", "Enable this courier?", array("0" => "No", "1" => "Yes"))->setEmptyString("(Select one)")->setRightTitle("Can customers use this courier?"))))); return $fields; }
/** * Gets a list of form fields for editing the record. * These records should never be edited, so a readonly list of fields * is forced. * * @return FieldList */ public function getCMSFields() { preg_match("/<body[^>]*>(.*?)<\\/body>/is", $this->Body, $matches); $contents = $matches ? $matches[1] : ""; $f = FieldList::create(ReadonlyField::create('To'), ReadonlyField::create('Subject'), ReadonlyField::create('BCC'), ReadonlyField::create('CC'), HeaderField::create('Email contents', 5), LiteralField::create('BodyContents', "<div class='field'>{$contents}</div>")); return $f; }
public function getCMSFields() { Requirements::css(BLOGGER_DIR . '/css/cms.css'); $self =& $this; $this->beforeUpdateCMSFields(function ($fields) use($self) { $fields->addFieldsToTab('Root.Main', array(HeaderField::create('Post Options', 3), $publishDate = DatetimeField::create("PublishDate", _t("BlogPost.PublishDate", "Publish Date")), ListboxField::create("Categories", _t("BlogPost.Categories", "Categories"), $self->Parent()->Categories()->map()->toArray())->setMultiple(true), ListboxField::create("Tags", _t("BlogPost.Tags", "Tags"), $self->Parent()->Tags()->map()->toArray())->setMultiple(true))); $publishDate->getDateField()->setConfig("showcalendar", true); // Add featured image $fields->insertBefore($uploadField = UploadField::create("FeaturedImage", _t("BlogPost.FeaturedImage", "Featured Image")), "Content"); $uploadField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif')); }); $fields = parent::getCMSFields(); // We're going to make an SEO tab and move all the usual crap there $menuTitle = $fields->dataFieldByName('MenuTitle'); $urlSegment = $fields->dataFieldByName('URLSegment'); $fields->addFieldsToTab('Root.SEO', array($menuTitle, $urlSegment)); $metaField = $fields->fieldByName('Root.Main.Metadata'); if ($metaField) { $metaFields = $metaField->getChildren(); if ($metaFields->count() > 0) { $tab = $fields->findOrMakeTab('Root.SEO'); $tab->push(HeaderField::create('Meta', 3)); foreach ($metaFields as $field) { $tab->push($field); } } $fields->removeByName('Metadata'); } 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 __construct($controller, $name, $order) { /* Store Settings Object */ $conf = StoreSettings::get_settings(); /* Comments Box, if enabled */ if ($conf->CheckoutSettings_OrderComments) { $comments = TextareaField::create("CustomerComments", "Order Comments"); $comments->setRightTitle("These comments will be seen by staff."); } else { $comments = HiddenField::create("CustomerComments", ""); } /* Terms and Conditions, if enabled */ if ($conf->CheckoutSettings_TermsAndConditions) { $terms = CheckboxField::create("Terms", "I agree to " . $conf->StoreSettings_StoreName . "'s " . "<a href=" . DataObject::get_by_id("SiteTree", $conf->CheckoutSettings_TermsAndConditionsSiteTree)->URLSegment . ">" . "Terms & Conditions</a>."); } else { $terms = HiddenField::create("Terms", ""); } /* Fields */ $fields = FieldList::create($comments, OptionsetField::create("PaymentMethod", "Payment Method", Gateway::create()->getGateways($order)), $terms ? HeaderField::create("Terms and Conditions", 5) : HiddenField::create("TermsHeaderField", ""), $terms); /* Actions */ $actions = FieldList::create(FormAction::create('payment', 'Place Order & Continue to Payment')); /* Required Fields */ $required = new RequiredFields(array("PaymentMethod", $terms ? "Terms" : null)); /* * Now we create the actual form with our fields and actions defined * within this class. */ return parent::__construct($controller, $name, $fields, $actions, $required); }
/** * Display the vanity mapping fields. */ public function updateSettingsFields($fields) { $fields->addFieldToTab('Root.Misdirection', HeaderField::create('VanityHeader', 'Vanity')); $fields->addFieldToTab('Root.Misdirection', TextField::create('VanityURL', 'URL', $this->owner->VanityMapping()->MappedLink)->setRightTitle('Mappings with higher priority will take precedence over this')); // Allow extension customisation. $this->owner->extend('updateSiteTreeMisdirectionExtensionSettingsFields', $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 updateDynamicListCMSFields($fields) { // Make sure the draft records are being looked at. $stage = Versioned::current_stage(); Versioned::reading_stage('Stage'); $used = EditableFormField::get()->filter(array('ClassName:PartialMatch' => 'DynamicList')); // Determine whether this dynamic list is being used anywhere. $found = array(); foreach ($used as $field) { // This information is stored using a serialised list, therefore we need to iterate through. if ($field->getSetting('ListTitle') === $this->owner->Title) { // Make sure there are no duplicates recorded. if (!isset($found[$field->ParentID]) && ($form = UserDefinedForm::get()->byID($field->ParentID))) { $found[$field->ParentID] = "<a href='{$form->CMSEditLink()}'>{$form->Title}</a>"; } } } // Display whether there were any dynamic lists found on user defined forms. if (count($found)) { $fields->removeByName('UsedOnHeader'); $fields->addFieldToTab('Root.Main', HeaderField::create('UsedOnHeader', 'Used On', 5)); } $display = count($found) ? implode('<br>', $found) : 'This dynamic list is <strong>not</strong> used.'; $fields->removeByName('UsedOn'); $fields->addFieldToTab('Root.Main', LiteralField::create('UsedOn', '<div>' . $display . '</div>')); Versioned::reading_stage($stage); }
public function getCMSFields() { Requirements::css('widgetify/thirdparty/codemirror-3.18/lib/codemirror.css'); Requirements::css('widgetify/css/widgetify_cms.css'); Requirements::javascript('framework/thirdparty/jquery/jquery.js'); Requirements::javascript('widgetify/thirdparty/codemirror-3.18/lib/codemirror.js'); Requirements::javascript('widgetify/thirdparty/codemirror-3.18/mode/xml/xml.js'); Requirements::javascript('widgetify/thirdparty/codemirror-3.18/mode/javascript/javascript.js'); Requirements::javascript('widgetify/thirdparty/codemirror-3.18/mode/css/css.js'); Requirements::javascript('widgetify/scripts/template_editor.js'); $fields = FieldList::create(); $fields->push(TextField::create('Title', 'Template Title', false, 100)); $fields->push(HeaderField::create('WidgetifyPreviewTitle', 'Preview', 4)); $fields->push(LiteralField::create('WidgetifyPreview', '<div id="widgetifyPreview" class="widgetifyTemplate"><p><strong>Click "Refresh & validate" to load preview</strong></p></div><p><a href="javascript:;" id="refreshAndValidate" class="ss-ui-action-constructive ss-ui-button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary">Refresh & validate</a></p>')); $fields->push(LiteralField::create('WidgetifyLog', '<p><strong>Validation log:</strong></p><div id="widgetifyLog"></div>')); $fields->push(HeaderField::create('WidgetifyEditorTitle', 'Template editor', 4)); $fields->push(LiteralField::create('WidgetifyEditorHelp', '<p><strong>Note:</strong> in the HTML tab, insert the tag <strong>{widget-UniqueIdentifier}</strong> where widgets should be placed. <em>Example: {widget-1} {widget-2} ...</em></p>')); $fields->push(LiteralField::create('Tabs', '<p class="tabs"><a href="javascript:;" id="tabTemplate" class="selected tabChange">HTML</a><a href="javascript:;" id="tabCSS" class="tabChange">Stylesheet</a><a href="javascript:;" id="tabJS" class="tabChange">Javascript</a></p>')); $fields->push(TextareaField::create('TemplateContent', false)); $fields->push(TextareaField::create('CSSContent', false)); $fields->push(TextareaField::create('JSContent', false)); if ($this->ID) { $fields->push(HeaderField::create('WidgetifyRelatedTitle', 'Pages using this template', 4)); $fields->push(LiteralField::create('AppliedTo', $this->_getTablePages())); } return $fields; }
public function updateFields($fields) { Requirements::javascript(MISDIRECTION_PATH . '/javascript/misdirection-fallback.js'); // Update any fields that are displayed when not viewing a page. $tab = 'Root.Misdirection'; $options = array('Nearest' => 'Nearest Parent', 'This' => 'This Page', 'URL' => 'URL'); if ($this->owner instanceof SiteConfig) { $tab = 'Root.Pages'; unset($options['This']); } // Retrieve the fallback mapping selection. $fields->addFieldToTab($tab, HeaderField::create('FallbackHeader', 'Fallback')); $fields->addFieldToTab($tab, DropdownField::create('Fallback', 'To', $options)->addExtraClass('fallback')->setHasEmptyDefault(true)->setRightTitle('This will be used when children result in a <strong>page not found</strong>')); $fields->addFieldToTab($tab, TextField::create('FallbackLink', 'URL')->addExtraClass('fallback-link')); // Retrieve the response code selection. $responses = Config::inst()->get('SS_HTTPResponse', 'status_codes'); $selection = array(); foreach ($responses as $code => $description) { if ($code >= 300 && $code < 400) { $selection[$code] = "{$code}: {$description}"; } } $fields->addFieldToTab($tab, DropdownField::create('FallbackResponseCode', 'Response Code', $selection)->addExtraClass('fallback-response-code')); // Allow extension customisation. $this->owner->extend('updateMisdirectionFallbackExtensionFields', $fields); }
/** * Add the Meta tag CMS fields * * @since version 1.0.0 * * @return object Return the current page fields **/ public function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeByName('Main'); $fields->addFieldsToTab('Root.SEO', [HeaderField::create('Meta Tag'), DropdownField::create('Type', 'Tag type', $this->tagTypes()), TextField::create('Name'), TextField::create('Value'), HiddenField::create('PageID')]); return $fields; }
public function getCMSFields() { $fields = FieldList::create(HeaderField::create('Outer Captions'), $category = DropdownField::create('FeaturedWorkCategoryID', 'Category', ProjectCategory::get()->map('ID', 'Title')), $imgUploadField = UploadField::create('ProjectCoverImage', 'Cover Image'), TextareaField::create('ProjectBriefDesc', 'Hover Over Description'), TextField::create('ProjectTitle', 'Title'), HeaderField::create('Project Phases'), $imgPhase1 = UploadField::create('ProjectPhaseImg1', 'Phase 1 Image'), TextareaField::create('ProjectPhaseDesc1', 'Phase 1 Description'), $imgPhase2 = UploadField::create('ProjectPhaseImg2', 'Phase 2 Image'), TextareaField::create('ProjectPhaseDesc2', 'Phase 2 Description'), $imgPhase3 = UploadField::create('ProjectPhaseImg3', 'Phase 3 Image'), TextareaField::create('ProjectPhaseDesc3', 'Phase 3 Description'), $imgPhase4 = UploadField::create('ProjectPhaseImg4', 'Phase 4 Image'), TextareaField::create('ProjectPhaseDesc4', 'Phase 4 Description'), $imgPhase5 = UploadField::create('ProjectPhaseImg5', 'Phase 5 Image'), TextareaField::create('ProjectPhaseDesc5', 'Phase 5 Description'), $imgPhase6 = UploadField::create('ProjectPhaseImg6', 'Phase 6 Image'), TextareaField::create('ProjectPhaseDesc6', 'Phase 6 Description')); //create inner GridField for ProjectPhases images /*$fields->addFieldToTab('Root.Phases', GridField::create( 'ProjectPhases', 'Project Phases', $this->ProjectPhases(), GridFieldConfig_RecordEditor::create() ));*/ //set image upload getTempFolder $imgUploadField->setFolderName('Featured Works Images'); //validate image upload types $imgUploadField->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpg', 'jpeg')); //project phase img 1 $imgPhase1->setFolderName('Project Phase Images'); $imgPhase1->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpg', 'jpeg')); //project phase img 2 $imgPhase2->setFolderName('Project Phase Images'); $imgPhase2->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpg', 'jpeg')); //project phase img 3 $imgPhase3->setFolderName('Project Phase Images'); $imgPhase3->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpg', 'jpeg')); //project phase img 4 $imgPhase4->setFolderName('Project Phase Images'); $imgPhase4->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpg', 'jpeg')); //project phase img 5 $imgPhase5->setFolderName('Project Phase Images'); $imgPhase5->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpg', 'jpeg')); //project phase img 6 $imgPhase6->setFolderName('Project Phase Images'); $imgPhase6->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpg', 'jpeg')); //return the fields return $fields; }
/** * @param FieldList $fields */ public function updateCMSFields(FieldList $fields) { /** ========================================= * @var TextareaField $address * @var TextareaField $postalAddress * @var TextField $mailChimpAPI * @var TextareaField $mailChimpSuccessMessage ===========================================*/ if (!$fields->fieldByName('Root.Settings')) { $fields->addFieldToTab('Root', TabSet::create('Settings')); } /** ----------------------------------------- * Details * ----------------------------------------*/ $address = TextareaField::create('Address', 'Address'); $address->setRows(8); $postalAddress = TextareaField::create('PostalAddress', 'Postal Address'); $postalAddress->setRows(8); $fields->findOrMakeTab('Root.Settings.Details'); $fields->addFieldsToTab('Root.Settings.Details', array(HeaderField::create('', 'Company Details'), Textfield::create('Phone', 'Phone Number'), Textfield::create('Email', 'Public Email Address'), $address, $postalAddress, TextField::create('Facebook', 'Facebook'), TextField::create('LinkedIn', 'LinkedIn'), TextField::create('Pinterest', 'Pinterest'), TextField::create('TwitterHandle', 'Twitter Handle'))); /** ----------------------------------------- * Subscription * ----------------------------------------*/ $mailChimpAPI = TextField::create('MailChimpAPI', 'API Key'); $mailChimpSuccessMessage = TextareaField::create('MailChimpSuccessMessage', 'Success Message (optional)'); $mailChimpAPI->setRightTitle('<a href="https://us9.admin.mailchimp.com/account/api-key-popup/" target="_blank"><i>How do I get my MailChimp API Key?</i></a>'); $mailChimpSuccessMessage->setRows(2)->setRightTitle('Message displayed when a user has successfully subscribed to a list.'); $fields->findOrMakeTab('Root.Settings.Subscription', 'Subscription'); $fields->addFieldsToTab('Root.Settings.Subscription', array(HeaderField::create('', 'Newsletter Subscription'), LiteralField::create('', '<p>The API key, and list ID are necessary for the Newsletter Subscription form to function.</p>'), $mailChimpAPI, TextField::create('MailChimpListID', 'List ID'), $mailChimpSuccessMessage)); }
/** * 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; }
/** * @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; }