public function updateCMSFields(FieldList $fields)
 {
     // Main
     $fields->addFieldToTab('Root.Main', $gaCode = new TextField('GACode', 'Google Analytics account'));
     $gaCode->setRightTitle('Account number to be used all across the site (in the format <strong>UA-XXXXX-X</strong>)');
     $fields->addFieldToTab('Root.Main', $showTitle = new CheckboxField('ShowTitleInHeader', 'Show title in header'), 'Tagline');
     /* @var $logoField UploadField */
     $logoField = new UploadField('Logo', 'Large logo, to appear in the header.');
     $logoField->setAllowedFileCategories('image');
     $logoField->setConfig('allowedMaxFileNumber', 1);
     $mobileLogoField = new UploadField('LogoMobile', 'Mobile logo, to appear in the header.');
     $mobileLogoField->setAllowedFileCategories('image');
     $mobileLogoField->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Main', $logoField);
     $fields->addFieldToTab('Root.Main', $this->getLogoOffSetField());
     $fields->addFieldToTab('Root.Main', $mobileLogoField);
     $fields->addFieldToTab('Root.Main', $this->getMobileLogoOffSetField());
     //Footer
     $fields->addFieldToTab('Root.Footer', $footerLogoField = new UploadField('FooterLogo', 'Footer logo, to appear in the bottom right.'));
     $footerLogoField->setAllowedFileCategories('image');
     $footerLogoField->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Footer', $footerLink = new TextField('FooterLogoLink', 'Footer Logo link'));
     $footerLink->setRightTitle('Please include the protocol (ie, http:// or https://) unless it is an internal link.');
     $fields->addFieldToTab('Root.Footer', new TextField('FooterLogoDescription', 'Footer Logo description'));
     $fields->addFieldToTab('Root.Footer', new TreeMultiselectField('FooterLinks', 'Footer Links', 'SiteTree'));
     $fields->addFieldToTab('Root.Footer', new TextField('Copyright', 'Copyright'));
 }
 /**
  * standard SS method
  * @var Array
  **/
 public function updateCMSFields(FieldList $fields)
 {
     //separate MetaTitle
     if (Config::inst()->get("MetaTagsContentControllerEXT", "use_separate_metatitle") == 1) {
         $fields->addFieldToTab('Root.Main.Metadata', $allowField0 = new TextField('MetaTitle', _t('SiteTree.METATITLE', 'Meta Title')), "MetaDescription");
         $allowField0->setRightTitle(_t("SiteTree.METATITLE_EXPLANATION", "Leave this empty to use the page title"));
     }
     //info about automation
     $fields->addFieldToTab('Root.Main.Metadata', $allowField1 = new CheckboxField('AutomateMetatags', _t('MetaManager.UPDATEMETA', 'Automatically update Meta Description and Navigation Label? ')));
     $automatedFields = $this->updatedFieldsArray();
     $updatedFieldString = "";
     if (count($automatedFields)) {
         $updatedFieldString = "" . _t("MetaManager.UPDATED_EXTERNALLY", "Based on your current settings, the following fields will be automatically updated at all times") . ": <em>" . implode("</em>, <em>", $automatedFields) . "</em>.";
         foreach ($automatedFields as $fieldName => $fieldTitle) {
             $oldField = $fields->dataFieldByName($fieldName);
             if ($oldField) {
                 $newField = $oldField->performReadonlyTransformation();
                 //$newField->setTitle($newField->Title());
                 $newField->setRightTitle(_t("MetaTags.AUTOMATICALLY_UPDATED", "Automatically updated when you save this page (see metadata settings)."));
                 $fields->replaceField($fieldName, $newField);
             }
         }
     }
     $fields->removeByName('ExtraMeta');
     $linkToManager = Config::inst()->get("MetaTagCMSControlPages", "url_segment") . '/';
     $fields->addFieldToTab('Root.Main.Metadata', new LiteralField("LinkToManagerHeader", "<blockquote style='padding-left: 12px;'>\n\t\t\t\t\t<p>\n\t\t\t\t\t\tOpen the Meta Tag Manager to\n\t\t\t\t\t\t<a href=\"{$linkToManager}\" target=\"_blank\">Review and Edit</a>\n\t\t\t\t\t\tthe Meta Data for all pages on this site.\n\t\t\t\t\t\tAlso make sure to review the general settings for\n\t\t\t\t\t\t<a href=\"/admin/settings/\">Search Engines</a>. {$updatedFieldString}\n\t\t\t\t\t</p>\n\t\t\t\t</blockquote>"));
     if ($this->owner->URLSegment == RootURLController::get_default_homepage_link()) {
         $newField = $fields->dataFieldByName('URLSegment');
         $newField->setRightTitle("Careful: changing the URL from 'home' to anything else means that this page will no longer be the home page");
         $fields->replaceField('URLSegment', $newField);
     }
     return $fields;
 }
 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;
 }
 public function updateSiteCMSFields(FieldList $fields)
 {
     $fields->addFieldToTab('Root.Main', $gaCode = new TextField('GACode', 'Google Analytics account'));
     $gaCode->setRightTitle('Account number to be used all across the site (in the format <strong>UA-XXXXX-X</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $facebookURL = new TextField('FacebookURL', 'Facebook UID or username'));
     $facebookURL->setRightTitle('Facebook link (everything after the "http://facebook.com/", eg http://facebook.com/<strong>username</strong> or http://facebook.com/<strong>pages/108510539573</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $twitterUsername = new TextField('TwitterUsername', 'Twitter username'));
     $twitterUsername->setRightTitle('Twitter username (eg, http://twitter.com/<strong>username</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $addThisID = new TextField('AddThisProfileID', 'AddThis Profile ID'));
     $addThisID->setRightTitle('Profile ID to be used all across the site (in the format <strong>ra-XXXXXXXXXXXXXXXX</strong>)');
     $fields->addFieldToTab('Root.Logos/Icons', $favIconField = new UploadField('FavIcon', 'Favicon, in .ico format, dimensions of 16x16, 32x32, or 48x48'));
     $favIconField->getValidator()->setAllowedExtensions(array('ico'));
     $favIconField->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos/Icons', $atIcon144 = new UploadField('AppleTouchIcon144', 'Apple Touch Web Clip and Windows 8 Tile Icon (dimensions of 144x144, PNG format)'));
     $atIcon144->getValidator()->setAllowedExtensions(array('png'));
     $atIcon144->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos/Icons', $atIcon114 = new UploadField('AppleTouchIcon114', 'Apple Touch Web Clip Icon (dimensions of 114x114, PNG format)'));
     $atIcon114->getValidator()->setAllowedExtensions(array('png'));
     $atIcon114->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos/Icons', $atIcon72 = new UploadField('AppleTouchIcon72', 'Apple Touch Web Clip Icon (dimensions of 72x72, PNG format)'));
     $atIcon72->getValidator()->setAllowedExtensions(array('png'));
     $atIcon72->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos/Icons', $atIcon57 = new UploadField('AppleTouchIcon57', 'Apple Touch Web Clip Icon (dimensions of 57x57, PNG format)'));
     $atIcon57->getValidator()->setAllowedExtensions(array('png'));
     $atIcon57->setConfig('allowedMaxFileNumber', 1);
 }
 public function updateCMSFields(FieldList $fields)
 {
     $type = new DropdownField('EventType', _t('ScoutDistrict.Events.TYPE', 'Type'), array('section-meeting' => _t('ScoutDistrict.Enum.SECTIONMEETING', 'Section Meeting'), 'leaders-meeting' => _t('ScoutDistrict.Enum.LEADERSMEETING', 'Leaders Meeting'), 'activity' => _t('ScoutDistrict.Enum.ACTIVITY', 'Activity'), 'fundraising' => _t('ScoutDistrict.Enum.FUNDRAISING', 'Fundraising'), 'committee' => _t('ScoutDistrict.Enum.COMMITTEE', 'Committee'), 'camp' => _t('ScoutDistrict.Enum.CAMP', 'Camp'), 'group' => _t('ScoutDistrict.Enum.GROUP', 'Group'), 'district' => _t('ScoutDistrict.Enum.DISTRICT', 'District'), 'training' => _t('ScoutDistrict.Enum.TRAINING', 'Training'), 'other' => _t('ScoutDistrict.Enum.OTHER', 'Other')));
     $type->setRightTitle(_t('ScoutDistrict.Events.TYPE_HELP', 'What Type of event is this'))->addExtraClass('help');
     $location = new TextField('EventLocation', _t('ScoutDistrict.Events.LOCATION', 'Location'));
     $location->setRightTitle(_t('ScoutDistrict.Events.LOCATION_HELP', 'Where is the event being held'))->addExtraClass('help');
     $latitude = new TextField('EventLatitude', _t('ScoutDistrict.Events.LATITUDE', 'Latitude'));
     $latitude->setRightTitle(_t('ScoutDistrict.Events.LATITUDE_HELP', 'Latitude of event Location'))->addExtraClass('help');
     $longitude = new TextField('EventLongitude', _t('ScoutDistrict.Events.LONGITUDE', 'Longitude'));
     $longitude->setRightTitle(_t('ScoutDistrict.Events.LONGITUDE_HELP', 'Longitude of event Location'))->addExtraClass('help');
     $bookingDetails = new TextareaField('EventBookingDetails', _t('ScoutDistrict.Events.BOOKINGDETAILS', 'Booking Details'));
     $bookingDetails->setRightTitle(_t('ScoutDistrict.Events.BOOKINGDETAILS_HELP', 'Details of how to book a place for the Event'))->addExtraClass('help');
     $bookingURL = new TextField('EventBookingURL', _t('ScoutDistrict.Events.BOOKINGURL', 'Booking URL'));
     $bookingURL->setRightTitle(_t('ScoutDistrict.Events.BOOKINGURL_HELP', 'The URL of an external site to book a place'))->addExtraClass('help');
     $fields->addFieldsToTab('Root.Scouts', array($type, $location, $latitude, $longitude, $bookingDetails, $bookingURL));
     $thumbnail = new UploadField('ThumbnailImage', _t('ScoutDistrict.Events.THUMBNAIL', 'Thumbnail Image'));
     $thumbnail->setFolderName('event/thumbnail');
     $thumbnail->setRightTitle(_t('ScoutDistrict.Events.THUMBNAIL_HELP', 'A small image for displaying in listing/aggregated content'))->addExtraClass('help');
     $image = new UploadField('Image', _t('ScoutDistrict.Events.IMAGE', 'Image'));
     $image->setFolderName('event/image');
     $image->setRightTitle(_t('ScoutDistrict.Events.IMAGE_HELP', 'A Larger image for displaying in event header'))->addExtraClass('help');
     $files = new UploadField('Files', _t('ScoutDistrict.Events.FILE', 'Files'));
     $files->setFolderName('event/file');
     $files->setRightTitle(_t('ScoutDistrict.Events.FILE_HELP', 'This can be a file containing information about the event or an application form, etc'))->addExtraClass('help');
     $fields->addFieldsToTab('Root.Files', array($thumbnail, $image, $files));
     return $fields;
 }
 public function updateCMSFields(FieldList $fields)
 {
     $metaFieldTitle = new TextField("MetaTitle", $this->owner->fieldLabel('MetaTitle'));
     $metaFieldTitle->setRightTitle(_t('SiteTree.METATITLEHELP', 'Shown at the top of the browser window and used as the "linked text" by search engines.'))->addExtraClass('help');
     $fields->insertBefore($metaFieldTitle, Config::inst()->get('MetaTitleExtension', 'InsertBefore'));
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $field = new TextField('Mobi2GoStoreName');
     $field->setRightTitle('eg. [store-name].mobi2go.com');
     $fields->addFieldsToTab('Root.Main', $field, 'Metadata');
     $fields->removeFieldFromTab('Root.Main', 'Content');
     return $fields;
 }
 /**
  * @return TextField|TextareaField
  */
 public function getFormField()
 {
     if ($rows = $this->Rows > 1) {
         $field = new TextareaField($this->getFormFieldName(), $this->Title, $this->Rows);
     } else {
         $field = new TextField($this->getFormFieldName(), $this->Title);
     }
     $field->setRightTitle(sprintf('<a href="#" class="ss-metadatasetfield-showreplacements">Available keyword replacements</a>'));
     return $field;
 }
 public function updateCMSFields(FieldList $fields)
 {
     /* -----------------------------------------
         * Comments
        ------------------------------------------*/
     $fields->findOrMakeTab('Root.Settings.Comments', 'Comments');
     $fields->addFieldsToTab('Root.Settings.Comments', array($disqusForumShortName = new TextField('DisqusForumShortName', 'Disqus forum shortname')));
     if (!SiteConfig::current_site_config()->DisqusForumShortName) {
         $disqusForumShortName->setRightTitle('Enables Disqus commenting on blog items. Sign up for your Disqus account at: <a href="http://disqus.com/" target="_blank">http://disqus.com/</a>');
     }
 }
 /**
  *
  *@return FieldList
  **/
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $dispatchedOnLabel = _t("OrderStatusLog.DISPATCHEDON", "Dispatched on");
     $fields->replaceField("DispatchedOn", $dispatchedOnField = new TextField("DispatchedOn", $dispatchedOnLabel));
     $dispatchedOnField->setRightTitle(_t("OrderStatusLog.DISPATCHED_ON_NOTE", "Please use year-month-date, e.g. 2015-11-23"));
     $dispatchLinkField = $fields->dataFieldByName("DispatchLink");
     $dispatchLinkField->setRightTitle(_t("OrderStatusLog.LINK_EXAMPLE", "e.g. http://www.ups.com/mytrackingnumber"));
     $dispatchLinkField = $fields->dataFieldByName("Note");
     $dispatchLinkField->setTitle(_t("OrderStatusLog.NOTE_NEW_TITLE", "Customer Message (*)"));
     $dispatchLinkField->setRightTitle(_t("OrderStatusLog.NOTE_NOTE", "This field is required"));
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     /* -----------------------------------------
         * Advanced
        ------------------------------------------*/
     $fields->addFieldToTab('Root.Main', new HeaderField('', _t('PortfolioHolder.SettingsText', 'Settings')), 'Content');
     $fields->addFieldToTab('Root.Main', $items = new TextField('Items', 'Items'), 'Content');
     $items->setRightTitle('How many items to display on each page');
     $fields->addFieldToTab('Root.Main', $columns = new DropdownField('Columns', 'Columns', array('One Item (Full Width)', 'Two Items', 'Three Items', 'Four Items')), 'Content');
     $columns->setRightTitle('How many items to display on each row');
     return $fields;
 }
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab("Root.Profiles", $defaultEmailTextField = new TextField("DefaultEmail"));
     $defaultEmailTextField->setRightTitle(_t("StaffProfilesPage.DEFAULT_EMAIL_EXPLANATION", "This is the default email that will be used if a staff member does not have a unique email"));
     $fields->addFieldToTab("Root.Profiles", $subjectLineTextField = new TextField("SubjectLine"));
     $subjectLineTextField->setRightTitle(_t("StaffProfilesPage.SUBJECT_LINE_EXPLANATION", "Subject line for email, you can use [" . implode("], [", array_keys(Config::inst()->get("StaffProfile", "subject_place_holders"))) . "]" . " as placeholders"));
     $fields->addFieldToTab("Root.Profiles", new GridField("StaffProfiles", "Staff Profiles", StaffProfile::get(), $config = GridFieldConfig_RelationEditor::create()));
     if (class_exists("GridFieldSortableRows")) {
         $config->addComponent(new GridFieldSortableRows('Sort'));
     }
     return $fields;
 }
 public function updateCMSFields(FieldList $fields)
 {
     $geoCountry = new CountryDropdownField('GeoCountry', _t('GeoTags.GEOCOUNTRY', 'Country'));
     $geoCountry->setRightTitle(_t('GeoTags.GEOCOUNTY_HELP', 'The Country of origin'))->addExtraClass('help');
     $geoRegion = new TextField('GeoRegion', _t('GeoTags.GEOREGION', 'REGION'));
     $geoRegion->setRightTitle(_t('GeoTags.GEOREGION_HELP', 'The Region in the Country of origin. Must use appropriate iso3166 region code'))->addExtraClass('help');
     $geoPlacename = new TextField('GeoPlacename', _t('GeoTags.GEOPLACENAME', 'Placename'));
     $geoPlacename->setRightTitle(_t('GeoTags.GEOPLACENAME_HELP', 'The Placename tag is provided primarily for resource recognition; it is anticipated that this field be harvested by automated agents and presented to the user in search engine results in a similar manner to the description META tag. This field is free-text, and typically would be used for city, county and state names. It could, however, be used for resource discovery'))->addExtraClass('help');
     $geoLong = new TextField('GeoLongitude', _t('GeoTags.GEOLONGITUDE', 'Longitude'));
     $geoLong->setRightTitle(_t('GeoTags.GEOLONGITUDE_HELP', 'The Longitude for the location'))->addExtraClass('help');
     $geoLat = new TextField('GeoLatitude', _t('GeoTags.GEOLATITUDE', 'Latitude'));
     $geoLat->setRightTitle(_t('GeoTags.GEOLATITUDE_HELP', 'The Latitude for the location'))->addExtraClass('help');
     $fields->addFieldsToTab('Root.GeoTags', array($geoCountry, $geoRegion, $geoPlacename, $geoLong, $geoLat));
     return $fields;
 }
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeFieldFromTab('Root.Main', 'Content');
     $fields->addFieldToTab('Root.Main', $url = new TextField('IFrameURL', 'Iframe URL'), 'Metadata');
     $url->setRightTitle('Can be absolute (<em>http://silverstripe.com</em>) or relative to this site (<em>about-us</em>).');
     $fields->addFieldToTab('Root.Main', DropdownField::create('ForceProtocol', 'Force protocol?')->setSource(array('http://' => 'http://', 'https://' => 'https://'))->setEmptyString('')->setDescription('Avoids mixed content warnings when iframe content is just available under a specific protocol'), 'Metadata');
     $fields->addFieldToTab('Root.Main', new CheckboxField('AutoHeight', 'Auto height (only works with same domain URLs)'), 'Metadata');
     $fields->addFieldToTab('Root.Main', new CheckboxField('AutoWidth', 'Auto width (100% of the available space)'), 'Metadata');
     $fields->addFieldToTab('Root.Main', new NumericField('FixedHeight', 'Fixed height (in pixels)'), 'Metadata');
     $fields->addFieldToTab('Root.Main', new NumericField('FixedWidth', 'Fixed width (in pixels)'), 'Metadata');
     $fields->addFieldToTab('Root.Main', new HtmlEditorField('Content', 'Content (appears above iframe)'), 'Metadata');
     $fields->addFieldToTab('Root.Main', new HtmlEditorField('BottomContent', 'Content (appears below iframe)'), 'Metadata');
     $fields->addFieldToTab('Root.Main', new HtmlEditorField('AlternateContent', 'Alternate Content (appears when user has iframes disabled)'), 'Metadata');
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     /* -----------------------------------------
         * Settings
        ------------------------------------------*/
     $fields->addFieldToTab('Root.Main', $columns = new DropdownField('Columns', _t('BlogHolder.ColumnsLabel', 'Columns'), array('One Item (Full Width)', 'Two Items', 'Three Items', 'Four Items')), 'Content');
     $columns->setRightTitle('Items per row');
     $fields->addFieldToTab('Root.Main', $items = new TextField('Items', _t('BlogHolder.ItemsLabel', 'Items')), 'Content');
     $items->setRightTitle('Items displayed per page');
     /* -----------------------------------------
         * Blog Sidebar
        ------------------------------------------*/
     $fields->addFieldToTab('Root.BlogSidebar', new HtmlEditorField('BlogSidebarContent', _t('BlogHolder.BlogSidebarLabel', 'Content For the Sidebar')));
     return $fields;
 }
Beispiel #16
0
 public function updateCMSFields(FieldList $fields)
 {
     $footerLinks = new GridField('FooterLinks', 'FooterLinks', $this->owner->FooterLinks(), $conf = GridFieldConfig_RelationEditor::create());
     $conf->addComponent(new GridFieldOrderableRows('Sort'));
     $footerLinks->getConfig()->getComponentByType('GridFieldAddNewButton')->setButtonName('Add Link to Footer');
     $fields->addFieldToTab('Root.Footer', $footerLinks);
     $fields->addFieldToTab('Root.Main', $gaCode = new TextField('GACode', 'Google Analytics account'));
     $gaCode->setRightTitle('Account number to be used all across the site (in the format <strong>UA-XXXXX-X</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $facebookURL = new TextField('FacebookURL', 'Facebook UID or username'));
     $facebookURL->setRightTitle('Facebook link (everything after the "http://facebook.com/", eg http://facebook.com/<strong>username</strong> or http://facebook.com/<strong>pages/108510539573</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $twitterUsername = new TextField('TwitterUsername', 'Twitter username'));
     $twitterUsername->setRightTitle('Twitter username (eg, http://twitter.com/<strong>username</strong>)');
     $fields->addFieldToTab('Root.Logos', $logoField = new UploadField('Logo', 'Logo'));
     $logoField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
     $logoField->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos', new TextField('LogoText', 'Logo Text'));
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Gallery', new HeaderField('Settings'));
     $fields->addFieldToTab('Root.Gallery', $columns = new DropdownField('Columns', _t('GalleryPage.ColumnsLabel', 'Columns'), array('One Item (Full Width)', 'Two Items', 'Three Items', 'Four Items', 'Six Items', 'Twelve Items')));
     $columns->setRightTitle('How many items to display on each row');
     $fields->addFieldToTab('Root.Gallery', $items = new TextField('Items', _t('GalleryPage.ItemsLabel', 'Items')));
     $items->setRightTitle('How many items to display on each page');
     $fields->addFieldToTab('Root.Gallery', new CheckboxField('NoMargin', 'Remove margin from between gallery items'));
     /* -----------------------------------------
         * Gallery Images
        ------------------------------------------*/
     $fields->addFieldToTab('Root.Gallery', new HeaderField('Images'));
     $fields->addFieldToTab('Root.Gallery', $images = new UploadField('Images', _t('GalleryPage.ImagesLabel', 'Images'), $this->owner->Images()));
     $images->setFolderName('Uploads/gallery');
     return $fields;
 }
 /**
  * @return FieldList
  */
 public function getCMSFields()
 {
     $fields = new FieldList();
     $from = new TextField('From', 'From');
     $from->setRightTitle('(e.g "/my-page/")- always include the /');
     $to = new TextField('To', 'To');
     $to->setRightTitle('e.g "/my-page/" for internal pages or "http://google.com/" for external websites (and include the scheme - http:// or https://)');
     $fields->push($manual = new ToggleCompositeField('TextLinks', 'Enter urls', [$from, $to]));
     $fields->push($page = new ToggleCompositeField('SiteTree', 'Select pages from list', [new TreeDropdownField('FromRelationID', 'From', 'SiteTree'), new TreeDropdownField('ToRelationID', 'To', 'SiteTree')]));
     $fields->push(new DropdownField('Type', 'Type', ['Vanity' => 'Vanity', 'Permanent' => 'Permanent']));
     if ($this->getField('From') || $this->getField('To')) {
         $manual->setStartClosed(false);
     }
     if ($this->getField('FromRelationID') || $this->getField('ToRelationID')) {
         $page->setStartClosed(false);
     }
     return $fields;
 }
Beispiel #19
0
 function getCMSFields()
 {
     $fields = FieldList::create(TabSet::create('Root'));
     /* -----------------------------------------
         * Color Picker
        ------------------------------------------*/
     Requirements::css('boilerplate/css/colorpicker.css');
     Requirements::javascript('boilerplate/javascript/colorpicker.min.js');
     Requirements::javascript('boilerplate/javascript/colorpicker.init.js');
     $fields->addFieldToTab('Root.Main', new TabSet($name = "WidgetTabs", new Tab($title = 'Page Item', new HeaderField(_t('PageItem.PageItemTabText', 'Title')), $titleField = new TextField('Title', _t('PageItem.TitleLabel', 'Page Item Title')), new HtmlEditorField('Content', _t('PageItem.ContentLabel', 'Content'))), new Tab($title = 'Columns', new HeaderField(_t('PageItem.ColumnsTabText', 'Columns')), $columnType = new DropdownField('ColumnType', 'Column Type', array(0 => 'Default', 1 => '1/3, 2/3', 2 => '2/3, 1/3')), $columnOne = new HtmlEditorField('ColumnOne', _t('PageItem.ColumnOneLabel', 'Column One')), $columnTwo = new HtmlEditorField('ColumnTwo', _t('PageItem.ColumnTwoLabel', 'Column Two')), $columnThree = new HtmlEditorField('ColumnThree', _t('PageItem.ColumnThreeLabel', 'Column Three')), $columnFour = new HtmlEditorField('ColumnFour', _t('PageItem.ColumnFourLabel', 'Column Four'))), new Tab($title = 'Settings', new HeaderField(_t('PageItem.SettingsTabText', 'Settings (Optional)')), new CheckboxField('Padding', _t('PageItem.PaddingLabel', 'Remove Padding')), new UploadField('BackgroundImage', _t('PageItem.BackgroundImageLabel', 'Background Image')), new DropdownField('BackgroundType', _t('PageItem.BackgroundTypeLabel', 'Background Type'), array('' => 'Default', 'fixed' => 'Fixed')), new ColorField('BackgroundColor', _t('PageItem.BackgroundColorLabel', 'Background Color')))));
     $rowHeight = 20;
     $titleField->setRightTitle(_t('PageItem.WidgetTitleDescriptionText', 'Name your page item to be easily recognisable in the page item list e.g "Pricing columns"'));
     $columnOne->setRows($rowHeight);
     $columnTwo->setRows($rowHeight);
     $columnThree->setRows($rowHeight);
     $columnFour->setRows($rowHeight);
     return $fields;
 }
Beispiel #20
0
 public function updateCMSFields(FieldList $fields)
 {
     $footerBanner = new UploadField('FooterBanner', 'Footer Banner');
     $footerBanner->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
     $footerBanner->setConfig('allowedMaxFileNumber', 1);
     $footerBannerLink = new TreeDropdownField('FooterBannerLinkID', 'Footer Banner Link', "SiteTree");
     $fields->addFieldToTab('Root.Footer', $footerBanner);
     $fields->addFieldToTab('Root.Footer', $footerBannerLink);
     $fields->addFieldToTab('Root.Main', $gaCode = new TextField('GACode', 'Google Analytics account'));
     $gaCode->setRightTitle('Account number to be used all across the site (in the format <strong>UA-XXXXX-X</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $facebookURL = new TextField('FacebookURL', 'Facebook UID or username'));
     $facebookURL->setRightTitle('Facebook link (everything after the "http://facebook.com/", eg http://facebook.com/<strong>username</strong> or http://facebook.com/<strong>pages/108510539573</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $twitterUsername = new TextField('TwitterUsername', 'Twitter username'));
     $twitterUsername->setRightTitle('Twitter username (eg, http://twitter.com/<strong>username</strong>)');
     $fields->addFieldToTab('Root.Logos', $logoField = new UploadField('Logo', 'Logo, to appear in the top left.'));
     $logoField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
     $logoField->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos', new TextField('LogoText', 'Logo Text'));
 }
 function updateCMSFields(FieldList $fields)
 {
     $fields->addFieldToTab('Root.Main', $gaCode = new TextField('GACode', 'Google Analytics account'));
     $gaCode->setRightTitle('Account number to be used all across the site (in the format <strong>UA-XXXXX-X</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $facebookURL = new TextField('FacebookURL', 'Facebook UID or username'));
     $facebookURL->setRightTitle('Facebook link (everything after the "http://facebook.com/", eg http://facebook.com/<strong>username</strong> or http://facebook.com/<strong>pages/108510539573</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $twitterUsername = new TextField('TwitterUsername', 'Twitter username'));
     $twitterUsername->setRightTitle('Twitter username (eg, http://twitter.com/<strong>username</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $addThisID = new TextField('AddThisProfileID', 'AddThis Profile ID'));
     $addThisID->setRightTitle('Profile ID to be used all across the site (in the format <strong>ra-XXXXXXXXXXXXXXXX</strong>)');
     $fields->addFieldToTab('Root.Logos', $logoField = new UploadField('Logo', 'Logo, to appear in the top left.'));
     $logoField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
     $logoField->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos', $footerLogoField = new UploadField('FooterLogo', 'Footer logo, to appear in the bottom right.'));
     $footerLogoField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
     $footerLogoField->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos', $footerLink = new TextField('FooterLogoLink', 'Footer Logo link'));
     $footerLink->setRightTitle('Please include the protocol (ie, http:// or https://) unless it is an internal link.');
     $fields->addFieldToTab('Root.Logos', new TextField('FooterLogoDescription', 'Footer Logo description'));
 }
 public function updateCMSFields(FieldList $fields)
 {
     /* -----------------------------------------
         * Fonts
        ------------------------------------------*/
     $fields->findOrMakeTab('Root.Settings.GoogleFonts', 'Google Fonts');
     $fields->addFieldToTab('Root.Settings.GoogleFonts', $fontAPI = new TextField('FontAPI', _t('GoogleFontConfig.FontAPILabel', 'Google Fonts API Key')));
     if (!SiteConfig::current_site_config()->FontAPI) {
         $fontAPI->setRightTitle('Once you\'ve saved your API key more font choices will be available');
     }
     if (SiteConfig::current_site_config()->FontAPI) {
         $googleFontsArray = SiteConfig::current_site_config()->getGoogleFonts('all');
         $googleFontsDropdownArray[''] = '-- Theme Default --';
         foreach ($googleFontsArray as $item) {
             $variants = ':' . implode(',', $item->variants);
             $googleFontsDropdownArray[$item->family . $variants] = $item->family;
         }
         $fields->addFieldsToTab('Root.Settings.GoogleFonts', array(new DropdownField('FontHeadings', _t('GoogleFontConfig.FontHeadingsLabel', 'Headings'), $googleFontsDropdownArray), new DropdownField('FontBody', _t('GoogleFontConfig.FontBodyLabel', 'Body'), $googleFontsDropdownArray)));
     }
 }
 public function updateCMSFields(FieldList $fields)
 {
     // Grab the latest database dumps made
     $links = '<div id="backup-latest-links">';
     $dir = scandir(ASSETS_PATH);
     foreach ($dir as $file) {
         $extn = pathinfo(ASSETS_PATH . DIRECTORY_SEPARATOR . $file, PATHINFO_EXTENSION);
         if ($extn != 'gz') {
             continue;
         }
         $links .= sprintf('<p><a href="%s">%s</a></p>' . "\n", ASSETS_DIR . DIRECTORY_SEPARATOR . $file, $file);
     }
     if ($links == '') {
         $links = '<p>No backups so far.</p>';
     }
     $links .= '</div>';
     $fields->addFieldsToTab('Root.Backup', array(new HeaderField('backup-heading', 'Backup'), new LiteralField('backup-explanation', '<p>This module backs up the database and assets, and optionally copies them to a target server via SCP.</p>'), new CheckboxField('BackupDatabaseEnabled', 'Back up the database?'), new CheckboxField('BackupAssetsEnabled', 'Back up the assets folder?'), new CheckboxField('BackupTransferEnabled', 'Transfer the backup files via SSH?'), $ip = new TextField('IPAddressOne', 'Nominated IP Address'), $ip2 = new TextField('IPAddressTwo', 'Alternate IP Address'), new LiteralField('backup-ssh', '<p>* SSH transfer requires the webserver user to have SSH authorized key set up on the target server.</p>'), new TextField('SSHUser', 'SSH user'), new TextField('SSHHost', 'SSH host'), $path = new TextField('SSHPath', 'SSH path'), new HeaderField('backup-latest-heading', 'Latest backups', 4), new LiteralField('backup-latest-links', $links), new LiteralField('backupNow', '<input type="button" id="backup-action" value="Back up now" class="ss-ui-button ui-button" role="button" aria-disabled="false">' . '<script type="text/javascript">' . 'jQuery(\'#backup-action\').click(function() {' . 'jQuery("<p id=\'waiter\' class=\'message notice\'>Backing up, please wait.</p>").insertAfter(jQuery("#Form_EditForm_backup-heading"));' . 'jQuery(\'html\').css(\'cursor\', \'wait\');' . 'jQuery.ajax(\'backup/BackupNow\', {' . '\'async\':\'false\',' . '\'success\': function(json){' . 'jQuery(\'html\').css(\'cursor\', \'default\');' . 'data = JSON.parse(json);' . 'if(data.Status == "Success"){' . 'jQuery("#backup-latest-links").html(data.Data);' . 'jQuery("#waiter").removeClass(\'notice\');' . 'jQuery("#waiter").addClass(\'good\');' . 'jQuery("#waiter").html("Backup Complete");' . '} else {' . 'jQuery("#waiter").removeClass(\'notice\');' . 'jQuery("#waiter").addClass(\'bad\');' . 'jQuery("#waiter").html(data.Data);' . '}' . '}' . '}); ' . '});' . '</script>')));
     $path->setRightTitle('Use the full server path, eg. /srv/backups/server-name');
     $ip->setRightTitle('The IP address from which the task can be called.');
     $ip2->setRightTitle('An alternate IP address from which the task can be called.');
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     Requirements::css('boilerplate/css/colorpicker.css');
     Requirements::javascript('boilerplate/javascript/colorpicker.min.js');
     Requirements::javascript('boilerplate/javascript/colorpicker.init.js');
     /* =========================================
        * Settings
        =========================================*/
     /* -----------------------------------------
         * Contact Page
        ------------------------------------------*/
     $fields->addFieldToTab('Root.Main', new HeaderField('Settings'), 'Content');
     $fields->addFieldToTab('Root.Main', $mailTo = new TextField('MailTo', _t('ContactPage.MailToLabel', 'Email')), 'Content');
     $mailTo->setRightTitle('Choose an email address for the contact page to send to');
     $fields->addFieldToTab('Root.Main', $mailCC = new TextField('MailCC', _t('ContactPage.MailCCLabel', 'CC')), 'Content');
     $mailCC->setRightTitle('Choose an email, or emails to CC (separate emails with a comma and no space e.g: email1@website.com,email2@website.com)');
     $fields->addFieldToTab('Root.Main', $submissionText = new TextareaField('SubmitText', _t('ContactPage.SubmitTextLabel', 'Submission Text')), 'Content');
     $submissionText->setRightTitle('Text for contact form submission once the email has been sent i.e "Thank you for your enquiry"');
     /* -----------------------------------------
         * Google Map
        ------------------------------------------*/
     $fields->addFieldToTab('Root.Map', new Textfield('GoogleAPI', _t('ContactPage.GoogleAPILabel', 'Maps API (Optional)')));
     $fields->addFieldToTab('Root.Map', new Textfield('Latitude', _t('ContactPage.LatitudeLabel', 'Latitude')));
     $fields->addFieldToTab('Root.Map', new Textfield('Longitude', _t('ContactPage.LongitudeLabel', 'Longitude')));
     $fields->addFieldToTab('Root.Map', $mapZoom = new Textfield('MapZoom', _t('ContactPage.MapZoomLabel', 'Zoom')));
     $mapZoom->setRightTitle(_t('ContactPage.MapZoomTitle', 'Zoom level: 0-22 - The higher the number the more zoomed in the map will be.'));
     $fields->addFieldToTab('Root.Map', new ColorField('MapColor', _t('ContactPage.MapColorLabel', 'Map Colour (Optional)')));
     $fields->addFieldToTab('Root.Map', new ColorField('WaterColor', _t('ContactPage.WaterColorLabel', 'Water Colour (Optional)')));
     $fields->addFieldToTab('Root.Map', new CheckboxField('MapMarker', _t('ContactPage.MapMarkerLabel', 'Show map marker')));
     /* -----------------------------------------
         * Info Windows
        ------------------------------------------*/
     $config = GridFieldConfig_RelationEditor::create(10);
     $config->addComponent(new GridFieldDeleteAction());
     $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Title' => 'Title'));
     $gridField = new GridField('InfoWindows', 'Markers', $this->owner->InfoWindows(), $config);
     $fields->addFieldToTab('Root.MapMarkers', $gridField);
     return $fields;
 }
Beispiel #25
0
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName("Title");
     $fields->removeByName("animation");
     $fields->removeByName("easing");
     $fields->removeByName("direction");
     $fields->removeByName("reverse");
     $fields->removeByName("dynamicLoading");
     $fields->removeByName("animationLoop");
     $fields->removeByName("slideshow");
     $fields->removeByName("slideshowSpeed");
     $fields->removeByName("animationSpeed");
     $fields->removeByName("randomize");
     $fields->removeByName("showControlNav");
     $animationTypes = $this->dbObject("animation")->enumValues();
     $easingTypes = $this->dbObject("easing")->enumValues();
     $directions = $this->dbObject("direction")->enumValues();
     // Main
     $field_Title = new TextField("Title", _t("FlexSlider.Title"));
     $field_Title->setRightTitle(_t("FlexSlider.TitleDescription"));
     $field_slideshow = new CheckboxField("slideshow", _t("FlexSlider.slideshow"));
     $field_animationLoop = new CheckboxField("animationLoop", _t("FlexSlider.animationLoop"));
     $field_animation = new Dropdownfield("animation", _t("FlexSlider.animationType"), $animationTypes);
     $field_direction = new Dropdownfield("direction", _t("FlexSlider.direction"), $directions);
     $field_easing = new Dropdownfield("easing", _t("FlexSlider.easingType"), $easingTypes);
     $field_easing->setRightTitle(_t("FlexSlider.easingTypeDescription"));
     $field_slideshowSpeedvalue = !$this->ID ? FlexSlider::$defaults["slideshowSpeed"] : $this->slideshowSpeed;
     $field_slideshowSpeed = new NumericField("slideshowSpeed", _t("FlexSlider.slideshowSpeed"), $field_slideshowSpeedvalue);
     $field_slideshowSpeed->setRightTitle(_t("FlexSlider.slideshowSpeedDescription"));
     $field_animationSpeedvalue = !$this->ID ? FlexSlider::$defaults["animationSpeed"] : $this->animationSpeed;
     $field_animationSpeed = new NumericField("animationSpeed", _t("FlexSlider.animationSpeed"), $field_animationSpeedvalue);
     $field_animationSpeed->setRightTitle(_t("FlexSlider.animationSpeedDescription"));
     $field_randomize = new CheckboxField("randomize", _t("FlexSlider.randomize"));
     $field_showControlNav = new CheckboxField("showControlNav", _t("FlexSlider.showControlNav"));
     $FieldsArray = array($field_Title, $field_slideshow, $field_animationLoop, $field_animation, $field_direction, $field_easing, $field_slideshowSpeed, $field_animationSpeed, $field_randomize, $field_showControlNav);
     $fields->addFieldsToTab('Root.Main', $FieldsArray);
     return $fields;
 }
 /**
  * standard SS Method
  */
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $labels = $this->fieldLabels(true);
     $fieldsToAdd = array(new TextField("TitleOfFile", $labels["TitleOfFile"]), $uploadField = new UploadField("DownloadFile", $labels["DownloadFile"]));
     if ($this->DownloadFileID) {
         $fieldsToAdd = array_merge($fieldsToAdd, array(new NumericField("ValidityInDays", $label["ValidityInDays"])));
     } else {
         $fieldsToAdd = array_merge($fieldsToAdd, array($linkToThirdPartyDownloadField = new TextField("LinkToThirdPartyDownload", $labels["LinkToThirdPartyDownload"])));
         $linkToThirdPartyDownloadField->setRightTitle(_t("EmailDownloadPage.LINKTOTHIRDPARTYDOWNLOAD_RIGHT_TITLE", "Set this to a third-party website link (e.g. dropbox) - e.g. http://www.mycooldownloadpage.com/mydownloadpage/"));
     }
     $fieldsToAdd = array_merge($fieldsToAdd, array(new CheckboxField("AllowReRequest", $labels["AllowReRequest"]), new TextField("EmailSubject", $labels["EmailSubject"]), new CheckboxField("CopyOfAllEmailsToAdmin", $labels["CopyOfAllEmailsToAdmin"] . " (" . Email::getAdminEmail() . ")"), new TextField("ThankYouForRequesting", $labels["ThankYouForRequesting"]), new TextField("ThankYouLink", $labels["ThankYouLink"])));
     if ($this->AllowReRequest) {
         $fieldsToAdd = array_merge($fieldsToAdd, array(new TextField("AllowReRequestLabel", $labels["AllowReRequestLabel"])));
     } else {
         $fieldsToAdd = array_merge($fieldsToAdd, array(new TextField("DeclineReRequestLabel", $labels["DeclineReRequestLabel"])));
     }
     $fieldsToAdd = array_merge($fieldsToAdd, array(new TextField("NoAccessContent", $labels["NoAccessContent"]), $gridField = new GridField("EmailsSent", $labels["EmailsSent"], $this->EmailsSent(), GridFieldConfig_RelationEditor::create())));
     $gridField->getConfig()->addComponent(new GridFieldExportButton());
     $fields->addFieldsToTab("Root.DownloadToEmail", $fieldsToAdd);
     return $fields;
 }
Beispiel #27
0
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $gridFieldConfig = GridFieldConfig_RecordEditor::create();
     $gridFieldConfig->addComponent(new GridFieldSortableRows('SortOrder'));
     $gridfield = new GridField("Pictures", "Pictures", $this->Pictures()->sort("SortOrder"), $gridFieldConfig);
     $fields->addFieldToTab('Root.Pictures', $gridfield);
     $fields->addFieldToTab('Root.Pictures', new DropdownField('Align', 'Align (relative to text)', singleton('Page')->dbObject('Align')->enumValues()), '');
     $gridFieldConfig2 = GridFieldConfig_RecordEditor::create();
     $gridFieldConfig2->addComponent(new GridFieldSortableRows('SortOrder'));
     $gridfield2 = new GridField("Videos", "Videos", $this->Videos()->sort("SortOrder"), $gridFieldConfig2);
     $fields->addFieldToTab('Root.Videos', $gridfield2);
     $fields->addFieldToTab('Root.Videos', new CheckboxField('Videobottom', 'Show all videos below'), '');
     $gridFieldConfig3 = GridFieldConfig_RecordEditor::create();
     $gridFieldConfig3->addComponent(new GridFieldSortableRows('SortOrder'));
     $gridfield3 = new GridField("ExtraContentBlocks", "ExtraContentBlocks", $this->ExtraContentBlocks()->sort("SortOrder"), $gridFieldConfig3);
     $fields->addFieldToTab('Root.Main', new LiteralField('Note1', '<br /><br />'), 'Metadata');
     // Spacer
     $fields->addFieldToTab('Root.Main', $gridfield3, 'Metadata');
     $fields->addFieldToTab('Root.Main', new LiteralField('Note2', '<br /><br />'), 'Metadata');
     // Spacer
     $fields->addFieldToTab('Root.Gallery', $uploadField = new SortableUploadField($name = 'GalleryImages', $title = 'Upload images (max 100 in total)'));
     $uploadField->setAllowedMaxFileNumber(100);
     $uploadField->setFolderName('GalleryImages');
     $uploadField->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
     $metatitle = new TextField('MetaTitle', 'Alternative Page Title');
     $metatitle->setRightTitle('Used in the browser window, search listings, bookmarks etc');
     $fields->addFieldToTab('Root.Main', $metatitle, 'MetaDescription');
     $CustomPreviewText = new TextAreaField('CustomPreviewText', 'Custom Preview Text');
     $CustomPreviewText->setRightTitle('Replaces the content summary for this page when shown on listing pages or search engines');
     $fields->addFieldToTab('Root.Main', $CustomPreviewText, 'MetaDescription');
     $fields->removeByName("Dependent");
     $fields->removeByName("MetaDescription");
     $fields->removeByName("ExtraMeta");
     return $fields;
 }
 /**
  * Return all fields of the backend.
  *
  * @return FieldList Fields of the CMS
  */
 public function getCMSFields()
 {
     $this->getCMSFieldsIsCalled = true;
     $fields = parent::getCMSFields();
     $useOnlydefaultGroupviewSource = array('inherit' => _t('SilvercartProductGroupPage.DEFAULTGROUPVIEW_DEFAULT'), 'yes' => _t('Silvercart.YES'), 'no' => _t('Silvercart.NO'));
     $useContentField = new CheckboxField('useContentFromParent', $this->fieldLabel('useContentFromParent'));
     $doNotShowProductsField = new CheckboxField('DoNotShowProducts', $this->fieldLabel('DoNotShowProducts'));
     $productsPerPageField = new TextField('productsPerPage', $this->fieldLabel('productsPerPage'));
     $defaultGroupViewField = SilvercartGroupViewHandler::getGroupViewDropdownField('DefaultGroupView', $this->fieldLabel('DefaultGroupView'), $this->DefaultGroupView, _t('SilvercartProductGroupPage.DEFAULTGROUPVIEW_DEFAULT'));
     $useOnlyDefaultGroupViewField = new DropdownField('UseOnlyDefaultGroupView', $this->fieldLabel('UseOnlyDefaultGroupView'), $useOnlydefaultGroupviewSource, $this->UseOnlyDefaultGroupView);
     $productGroupsPerPageField = new TextField('productGroupsPerPage', $this->fieldLabel('productGroupsPerPage'));
     $defaultGroupHolderViewField = SilvercartGroupViewHandler::getGroupViewDropdownField('DefaultGroupHolderView', $this->fieldLabel('DefaultGroupHolderView'), $this->DefaultGroupHolderView, _t('SilvercartProductGroupPage.DEFAULTGROUPVIEW_DEFAULT'));
     $useOnlyDefaultGroupHolderViewField = new DropdownField('UseOnlyDefaultGroupHolderView', $this->fieldLabel('UseOnlyDefaultGroupHolderView'), $useOnlydefaultGroupviewSource, $this->UseOnlyDefaultGroupHolderView);
     $fieldGroup = new SilvercartFieldGroup('FieldGroup', '', $fields);
     $productsPerPageField->setRightTitle(_t('SilvercartProductGroupPage.PRODUCTSPERPAGEHINT'));
     $productGroupsPerPageField->setRightTitle(_t('SilvercartProductGroupPage.PRODUCTSPERPAGEHINT'));
     $fieldGroup->push($useContentField);
     $fieldGroup->breakAndPush($doNotShowProductsField);
     $fieldGroup->breakAndPush($productsPerPageField);
     $fieldGroup->breakAndPush($defaultGroupViewField);
     $fieldGroup->push($useOnlyDefaultGroupViewField);
     $fieldGroup->breakAndPush($productGroupsPerPageField);
     $fieldGroup->breakAndPush($defaultGroupHolderViewField);
     $fieldGroup->push($useOnlyDefaultGroupHolderViewField);
     $displaySettingsToggle = ToggleCompositeField::create('DisplaySettingsToggle', $this->fieldLabel('DisplaySettings'), array($fieldGroup))->setHeadingLevel(4)->setStartClosed(true);
     $fields->insertAfter($displaySettingsToggle, 'Content');
     $mirroredProductIdList = '';
     $mirroredProductIDs = $this->getMirroredProductIDs();
     foreach ($mirroredProductIDs as $mirroredProductID) {
         $mirroredProductIdList .= sprintf("'%s',", $mirroredProductID);
     }
     if (!empty($mirroredProductIdList)) {
         $mirroredProductIdList = substr($mirroredProductIdList, 0, -1);
         $filter = sprintf("SilvercartProductGroupID = %d OR\n                 \"SilvercartProduct\".\"ID\" IN (%s)", $this->ID, $mirroredProductIdList);
     } else {
         $filter = sprintf("SilvercartProductGroupID = %d", $this->ID);
     }
     if ($this->drawCMSFields()) {
         $config = GridFieldConfig_RecordViewer::create(100);
         $productsTableField = new GridField('SilvercartProducts', $this->fieldLabel('SilvercartProducts'), SilvercartProduct::get()->filter(array('SilvercartProductGroupID' => $this->ID)), $config);
         $tabPARAM = "Root." . _t('SilvercartProduct.TITLE', 'product');
         $fields->addFieldToTab($tabPARAM, $productsTableField);
         $productAdminLink = Director::baseURL() . 'admin/silvercart-products';
         $manageProductsButton = new LiteralField('ManageProductsButton', sprintf("<a href=\"%s\">%s</a>", $productAdminLink, _t('SilvercartProductGroupPage.MANAGE_PRODUCTS_BUTTON')));
         $fields->addFieldToTab($tabPARAM, $manageProductsButton);
         $fields->addFieldToTab('Root.Main', new UploadField('GroupPicture', _t('SilvercartProductGroupPage.GROUP_PICTURE')), 'Content');
     }
     $widgetSetContent = $fields->fieldByName('Root.Widgets.WidgetSetContent');
     if ($widgetSetContent) {
         $widgetSetAdminLink = Director::baseURL() . 'admin/silvercart-widget-sets';
         $manageWidgetsButton = new LiteralField('ManageWidgetsButton', sprintf("<a href=\"%s\">%s</a>", $widgetSetAdminLink, _t('SilvercartWidgetSet.MANAGE_WIDGETS_BUTTON')));
         $fields->insertAfter($manageWidgetsButton, 'WidgetSetContent');
     }
     $this->extend('extendCMSFields', $fields);
     return $fields;
 }
 /**
  * Return all fields of the backend.
  *
  * @return FieldList Fields of the CMS
  */
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $useOnlydefaultGroupviewSource = array('inherit' => _t('SilvercartProductGroupPage.DEFAULTGROUPVIEW_DEFAULT'), 'yes' => $this->fieldLabel('Yes'), 'no' => $this->fieldLabel('No'));
     $defaultGroupViewField = SilvercartGroupViewHandler::getGroupViewDropdownField('DefaultGroupView', $this->fieldLabel('DefaultGroupView'), $this->DefaultGroupView, _t('SilvercartProductGroupPage.DEFAULTGROUPVIEW_DEFAULT'));
     $useOnlyDefaultGroupViewField = new DropdownField('UseOnlyDefaultGroupView', $this->fieldLabel('UseOnlyDefaultGroupView'), $useOnlydefaultGroupviewSource, $this->UseOnlyDefaultGroupView);
     $productGroupsPerPageField = new TextField('productGroupsPerPage', $this->fieldLabel('productGroupsPerPage'));
     $defaultGroupHolderViewField = SilvercartGroupViewHandler::getGroupViewDropdownField('DefaultGroupHolderView', $this->fieldLabel('DefaultGroupHolderView'), $this->DefaultGroupHolderView, $this->fieldLabel('DefaultGroupView'));
     $useOnlyDefaultGroupHolderViewField = new DropdownField('UseOnlyDefaultGroupHolderView', $this->fieldLabel('UseOnlyDefaultGroupHolderView'), $useOnlydefaultGroupviewSource, $this->UseOnlyDefaultGroupHolderView);
     $fieldGroup = new SilvercartFieldGroup('FieldGroup', '', $fields);
     $redirectionFieldGroup = new SilvercartFieldGroup('RedirectionFieldGroup', '', $fields);
     $redirectToProductGroupField = new CheckboxField('RedirectToProductGroup', $this->fieldLabel('RedirectToProductGroup'));
     $linkToField = new TreeDropdownField('LinkToID', $this->fieldLabel('LinkTo'), 'SiteTree');
     $productGroupsPerPageField->setRightTitle(_t('SilvercartProductGroupPage.PRODUCTSPERPAGEHINT'));
     $fieldGroup->push($defaultGroupViewField);
     $fieldGroup->push($useOnlyDefaultGroupViewField);
     $fieldGroup->breakAndPush($productGroupsPerPageField);
     $fieldGroup->breakAndPush($defaultGroupHolderViewField);
     $fieldGroup->push($useOnlyDefaultGroupHolderViewField);
     $redirectionFieldGroup->push($redirectToProductGroupField);
     if ($this->exists()) {
         $linkToField->setTreeBaseID($this->ID);
         $redirectionFieldGroup->breakAndPush($linkToField);
     }
     $displaySettingsToggle = ToggleCompositeField::create('DisplaySettingsToggle', $this->fieldLabel('DisplaySettings'), array($fieldGroup))->setHeadingLevel(4)->setStartClosed(true);
     $redirectionSettingsToggle = ToggleCompositeField::create('RedirectionSettingsToggle', $this->fieldLabel('RedirectionSettings'), array($redirectionFieldGroup))->setHeadingLevel(4)->setStartClosed(true);
     $fields->insertAfter($redirectionSettingsToggle, 'Content');
     $fields->insertAfter($displaySettingsToggle, 'Content');
     $this->extend('extendCMSFields', $fields);
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeFieldFromTab("Root", "Sort");
     $fields->removeFieldFromTab("Root.Main", "AdvertisementImage");
     $fields->removeFieldFromTab("Root.Main", "AdvertisementImageID");
     $fields->removeFieldFromTab("Root.Main", "LinkedPageID");
     $fields->removeFieldFromTab("Root.Main", "ExternalLink");
     $fields->removeFieldFromTab("Root.Parents", "Parents");
     $fields->removeFieldFromTab("Root", "Parents");
     $fields->addFieldToTab("Root.Main", new ReadonlyField("Link"));
     $fields->addFieldToTab("Root.Main", $mainImageField = new UploadField($name = "AdvertisementImage", $title = $this->i18n_singular_name()));
     $mainImageField->setRightTitle(self::recommended_image_size_statement());
     $fields->addFieldToTab("Root.Main", $additionalImageField = new UploadField($name = "AdditionalImage", $title = $this->i18n_singular_name() . " " . _t("Advertisement.ADDITIONAL_IMAGE", "additional image")));
     $additionalImageField->setRightTitle(self::recommended_image_size_statement());
     if ($this->ID) {
         $treeField = new TreeMultiselectField("Parents", _t("Advertisement.GETCMSFIELDSPARENTID", "only show on ... (leave blank to show on all " . $this->i18n_singular_name() . " pages)"), "SiteTree");
         /*$callback = $this->callbackFilterFunctionForMultiSelect();
         		if($callback) {
         			$treeField->setFilterFunction ($callback);
         		}*/
         $fields->addFieldToTab("Root.ShownOn", $treeField);
     }
     $fields->addFieldToTab("Root.OptionalLink", $externalLinkField = new TextField($name = "ExternalLink", $title = _t("Advertisement.GETCMSFIELDSEXTERNALLINK", "link to external site")));
     $externalLinkField->setRightTitle(_t("Advertisement.GETCMSFIELDSEXTERNALLINK_EXPLANATION", "(e.g. http://www.wikipedia.org) - this will override an internal link"));
     $fields->addFieldToTab("Root.OptionalLink", new TreeDropdownField($name = "LinkedPageID", $title = _t("Advertisement.GETCMSFIELDSEXTERNALLINKID", "link to a page on this website"), $sourceObject = "SiteTree"));
     $fields->addFieldToTab("Root.OptionalLink", new CheckboxField($name = "RemoveInternalLink", $title = _t("Advertisement.RemoveInternalLink", "remove internal link")));
     if (class_exists("DataObjectSorterController")) {
         //sorted on parent page...
     } else {
         $fields->addFieldToTab("Root.Position", $sortField = new NumericField("Sort", _t("Advertisement.SORT", "Sort index number")));
         $sortField->setRightTitle(_t("Advertisement.SORT_EXPLANATION", "the lower the number, the earlier it shows"));
     }
     $fields->removeFieldFromTab("Root.Main", "AlternativeSortNumber");
     return $fields;
 }