コード例 #1
0
 /**
  * @param string    $name
  * @param string    $label
  * @param FormField $field
  * @param bool      $open
  *
  * @return ToggleCompositeField
  */
 protected function getToggleField($name, $label, $field, $open = false)
 {
     $field = new ToggleCompositeField($name, $label, array($field));
     $field->addExtraClass("code-editor-toggle");
     $field->setStartClosed(!$open);
     return $field;
 }
コード例 #2
0
 /**
  * @return FieldList
  */
 public function getCMSFields()
 {
     $fields = new FieldList();
     $fields->push($manual = new ToggleCompositeField('TextLinks', 'Enter urls', [new TextField('From', 'From url (e.g. "/my-page/")'), new TextField('To', 'To url (e.g. "/my-page/", "http://google.com/")')]));
     $fields->push($page = new ToggleCompositeField('SiteTree', 'Select pages from list', [new TreeDropdownField('FromRelationID', 'From', 'SiteTree'), new TreeDropdownField('ToRelationID', 'To', 'SiteTree')]));
     if ($this->getField('From') || $this->getField('To')) {
         $manual->setStartClosed(false);
     }
     if ($this->getField('FromRelationID') || $this->getField('ToRelationID')) {
         $page->setStartClosed(false);
     }
     return $fields;
 }
 /**
  * Extracts out the field updating since that could happen at a couple
  * different extension points.
  * @param FieldList $fields
  */
 protected function updateFields(FieldList $fields)
 {
     // This seemed to cause problems. Moved to config.yml.
     //Requirements::javascript(SHOP_EXTENDEDPRICING_FOLDER . '/javascript/ExtendedPricingAdmin.js');
     $newFields = array(new CheckboxField("PromoActive", "Promotional pricing active?"), new OptionsetField("PromoDisplay", "Display Settings", array("ShowDiscount" => "Show base price crossed out", "HideDiscount" => "Hide base price")), new OptionsetField("PromoType", "Type of discount", array("Percent" => "Percentage of subtotal (eg 25%)", "Amount" => "Fixed amount (eg \$25.00)")), new PercentageField("PromoPercent", "Percent discount"), new NumericField("PromoAmount", "Fixed discount (e.g. 5 = \$5 off)"), new FieldGroup("Valid date range (optional):", array(PromoDatetimeField::create("PromoStartDate", "Start Date / Time"), PromoDatetimeField::create("PromoEndDate", "End Date / Time (you should set the end time to 23:59:59, if you want to include the entire end day)"))));
     $f = new ToggleCompositeField('PromoFields', 'Promotional Pricing', $newFields);
     $f->setStartClosed(!$this->getOwner()->PromoActive);
     if ($fields->hasTabSet()) {
         $fields->addFieldToTab('Root.Pricing', $f);
     } else {
         $fields->push($f);
     }
 }
 public function updateCMSFields(FieldList $fields)
 {
     // Payment Methods
     $payment_table = GridField::create('PaymentMethods', _t("CheckoutAdmin.PaymentMethods", "Payment Methods"), $this->owner->PaymentMethods(), GridFieldConfig::create()->addComponents(new GridFieldToolbarHeader(), new GridFieldAddNewButton('toolbar-header-right'), new GridFieldSortableHeader(), new GridFieldDataColumns(), new GridFieldPaginator(20), new GridFieldEditButton(), new GridFieldDeleteAction(), new GridFieldDetailForm()));
     // setup compressed payment options
     $payment_fields = ToggleCompositeField::create('PaymentSettings', _t("CheckoutAdmin.Payments", "Payment Settings"), array(TextField::create('PaymentNumberPrefix', _t("CheckoutAdmin.OrderPrefix", "Add prefix to order numbers"), null, 9)->setAttribute("placeholder", _t("CheckoutAdmin.OrderPrefixPlaceholder", "EG 'abc'")), TextAreaField::create('PaymentSuccessContent', _t("CheckoutAdmin.PaymentSuccessContent", "Payment successfull content"))->setRows(4)->setColumns(30)->addExtraClass('stacked'), TextAreaField::create('PaymentFailerContent', _t("CheckoutAdmin.PaymentFailerContent", "Payment failer content"))->setRows(4)->setColumns(30)->addExtraClass('stacked'), $payment_table));
     // Add html description of how to edit contries
     $country_html = "<div class=\"field\">";
     $country_html .= "<p>First select valid countries using the 2 character ";
     $country_html .= "shortcode (see http://fasteri.com/list/2/short-names-of-countries-and-iso-3166-codes).</p>";
     $country_html .= "<p>You can add multiple countries seperating them with";
     $country_html .= "a comma or use a '*' for all countries.</p>";
     $country_html .= "</div>";
     $country_html_field = LiteralField::create("CountryDescription", $country_html);
     // Deal with product features
     $postage_field = new GridField('PostageAreas', '', $this->owner->PostageAreas(), GridFieldConfig::create()->addComponents(new GridFieldButtonRow('before'), new GridFieldToolbarHeader(), new GridFieldTitleHeader(), new GridFieldEditableColumns(), new GridFieldDeleteAction(), new GridFieldAddNewInlineButton('toolbar-header-left')));
     // Add country dropdown to inline editing
     $postage_field->getConfig()->getComponentByType('GridFieldEditableColumns')->setDisplayFields(array('Title' => array('title' => 'Title', 'field' => 'TextField'), 'Country' => array('title' => 'ISO 3166 codes', 'field' => 'TextField'), 'ZipCode' => array('title' => 'Zip/Post Codes', 'field' => 'TextField'), 'Calculation' => array('title' => 'Base unit', 'callback' => function ($record, $column, $grid) {
         return DropdownField::create($column, "Based on", singleton('PostageArea')->dbObject('Calculation')->enumValues())->setValue("Weight");
     }), 'Unit' => array('title' => 'Unit (equals or above)', 'field' => 'NumericField'), 'Cost' => array('title' => 'Cost', 'field' => 'NumericField'), 'Tax' => array('title' => 'Tax (percentage)', 'field' => 'NumericField')));
     // Setup compressed postage options
     $postage_fields = ToggleCompositeField::create('PostageFields', 'Postage Options', array($country_html_field, $postage_field));
     // Setup compressed postage options
     $discount_fields = ToggleCompositeField::create('DiscountFields', 'Discounts', array(GridField::create('Discounts', '', $this->owner->Discounts(), GridFieldConfig_RecordEditor::create())));
     // Add config sets
     $fields->addFieldToTab('Root.Checkout', $payment_fields);
     $fields->addFieldToTab('Root.Checkout', $postage_fields);
     $fields->addFieldToTab('Root.Checkout', $discount_fields);
 }
 /**
  * Updates the fields used in the CMS
  * @see DataExtension::updateCMSFields()     
  */
 public function updateCMSFields(FieldList $fields)
 {
     Requirements::CSS('blogcategories/css/cms-blog-categories.css');
     // Try to fetch categories from cache
     $categories = $this->getAllBlogCategories();
     if ($categories->count() >= 1) {
         $cacheKey = md5($categories->sort('LastEdited', 'DESC')->First()->LastEdited);
         $cache = SS_Cache::factory('BlogCategoriesList');
         if (!($categoryList = $cache->load($cacheKey))) {
             $categoryList = "<ul>";
             foreach ($categories->column('Title') as $title) {
                 $categoryList .= "<li>" . Convert::raw2xml($title) . "</li>";
             }
             $categoryList .= "</ul>";
             $cache->save($categoryList, $cacheKey);
         }
     } else {
         $categoryList = "<ul><li>No categories exist. Categories can be added from the BlogTree or the BlogHolder page.</li></ul>";
     }
     //categories tab
     $gridFieldConfig = GridFieldConfig_RelationEditor::create();
     $fields->addFieldToTab('Root.Categories', GridField::create('BlogCategories', 'Blog Categories', $this->owner->BlogCategories(), $gridFieldConfig));
     $fields->addFieldToTab('Root.Categories', ToggleCompositeField::create('ExistingCategories', 'View Existing Categories', array(new LiteralField("CategoryList", $categoryList)))->setHeadingLevel(4));
     // Optionally default category to current holder
     if (Config::inst()->get('BlogCategory', 'limit_to_holder')) {
         $holder = $this->owner->Parent();
         $gridFieldConfig->getComponentByType('GridFieldDetailForm')->setItemEditFormCallback(function ($form, $component) use($holder) {
             $form->Fields()->push(HiddenField::create('ParentID', false, $holder->ID));
         });
     }
 }
コード例 #6
0
 public function getDefaultSearchContext()
 {
     $context = parent::getDefaultSearchContext();
     $fields = $context->getFields();
     $fields->push(CheckboxField::create("HasBeenUsed"));
     //add date range filtering
     $fields->push(ToggleCompositeField::create("StartDate", "Start Date", array(DateField::create("q[StartDateFrom]", "From")->setConfig('showcalendar', true), DateField::create("q[StartDateTo]", "To")->setConfig('showcalendar', true))));
     $fields->push(ToggleCompositeField::create("EndDate", "End Date", array(DateField::create("q[EndDateFrom]", "From")->setConfig('showcalendar', true), DateField::create("q[EndDateTo]", "To")->setConfig('showcalendar', true))));
     //must be enabled in config, because some sites may have many products = slow load time, or memory maxes out
     //future solution is using an ajaxified field
     if (self::config()->filter_by_product) {
         $fields->push(ListboxField::create("Products", "Products", Product::get()->map()->toArray())->setMultiple(true));
     }
     if (self::config()->filter_by_category) {
         $fields->push(ListboxField::create("Categories", "Categories", ProductCategory::get()->map()->toArray())->setMultiple(true));
     }
     if ($field = $fields->fieldByName("Code")) {
         $field->setDescription("This can be a partial match.");
     }
     //get the array, to maniplulate name, and fullname seperately
     $filters = $context->getFilters();
     $filters['StartDateFrom'] = GreaterThanOrEqualFilter::create('StartDate');
     $filters['StartDateTo'] = LessThanOrEqualFilter::create('StartDate');
     $filters['EndDateFrom'] = GreaterThanOrEqualFilter::create('EndDate');
     $filters['EndDateTo'] = LessThanOrEqualFilter::create('EndDate');
     $context->setFilters($filters);
     return $context;
 }
コード例 #7
0
    public function getCMSFields()
    {
        $fields = parent::getCMSFields();
        $fields->addFieldToTab('Root.EnquiryForm', HeaderField::create('Enquiry Form Setup', 2));
        $gridFieldConfig = GridFieldConfig_RecordEditor::create(100);
        $gridFieldConfig->addComponent(new GridFieldSortableRows('SortOrder'));
        /* Unset field-sorting hack */
        $gridFieldConfig->getComponentByType('GridFieldSortableHeader')->setFieldSorting(array('FieldName' => 'FieldNameNoSorting', 'FieldType' => 'FieldTypeNoSorting'));
        $gridField = GridField::create('EnquiryFormFields', false, $this->EnquiryFormFields(), $gridFieldConfig);
        $fields->addFieldToTab('Root.EnquiryForm', $gridField);
        $email_settings = array(EmailField::create('EmailTo', 'Send email to'), EmailField::create('EmailFrom', 'Send email from')->setRightTitle('For example website@yourdomain.com'), TextField::create('EmailSubject', 'Email subject'), HeaderField::create('Message on website once completed', 5), HTMLEditorField::create('EmailSubmitCompletion', '')->setRows(10), EmailField::create('EmailBcc', 'Send BCC copy to (optional)')->setRightTitle('If you would like a copy of the enquiry to be sent elsewhere, fill that in here.'), TextField::create('EmailSubmitButtonText', 'Submit button text'));
        $toggleSettings = ToggleCompositeField::create('FormSettings', 'Enquiry Form Settings', $email_settings);
        $fields->addFieldsToTab('Root.EnquiryForm', $toggleSettings);
        $spam_settings = array();
        array_push($spam_settings, DropdownField::create('AddCaptcha', 'Add captcha image (optional)', array(0 => 'No', 1 => 'Yes'))->setRightTitle('You can optionally enable an anti-spam "captcha" image.
			             This adds a small image with 4 random numbers which needs to be filled in correctly.'));
        if (!$this->CaptchaText) {
            $this->CaptchaText = 'Verification Image';
        }
        array_push($spam_settings, TextField::create('CaptchaText', 'Field name'));
        array_push($spam_settings, TextField::create('CaptchaHelp', 'Captcha help (optional)')->setRightTitle('If you would like to explain what the captcha is, please explain briefly what it is.
                    This is only used if you have selected to add the captcha image.'));
        $toggleSpam = ToggleCompositeField::create('SpamSettings', 'Anti-Spam Settings', $spam_settings);
        $fields->addFieldsToTab('Root.EnquiryForm', $toggleSpam);
        return $fields;
    }
 function updateCMSFields(FieldList $fields)
 {
     $fields->removeByName("SummaryContent");
     $fields->removeByName("SummaryImage");
     $summary_fields = ToggleCompositeField::create('Summary', 'Summary Info.', array(TextareaField::create("SummaryContent", $this->owner->fieldLabel('SummaryContent')), UploadField::create("SummaryImage", $this->owner->fieldLabel('SummaryImage'))))->setHeadingLevel(4);
     $fields->addFieldToTab('Root.Main', $summary_fields, 'Metadata');
 }
 /**
  * Gets the form used for viewing a time log
  */
 public function getEditForm($id = null, $fields = null)
 {
     $record = $this->currentPage();
     if ($this->action == 'view' && $record) {
         $fields = new FieldList(new HeaderField('LogHeader', _t('KapostBridgeLogViewer.VIEWING_ENTRY', '_Viewing Log Entry: {datetime}', array('datetime' => $record->dbObject('Created')->FormatFromSettings())), 3), new ReadonlyField('UserAgent', _t('KapostBridgeLogViewer.USER_AGENT', '_Requestor User Agent')), new ReadonlyField('Method', _t('KapostBridgeLogViewer.METHOD', '_Method')), ToggleCompositeField::create('RequestData', _t('KapostBridgeLogViewer.KAPOST_REQUEST', '_Kapost Request'), new FieldList(ReadonlyField::create('RequestFormatted', '')->setTemplate('KapostBridgeLogField')->addExtraClass('log-contents cms-panel-layout')))->setHeadingLevel(3), ToggleCompositeField::create('ResponseData', _t('KapostBridgeLogViewer.SILVERSTRIPE_RESPONSE', '_SilverStripe Response'), new FieldList(ReadonlyField::create('ResponseFormatted', '')->setTemplate('KapostBridgeLogField')->addExtraClass('log-contents cms-panel-layout')))->setHeadingLevel(3));
         $refObj = $record->ReferenceObject;
         if (!empty($refObj) && $refObj !== false && $refObj->exists()) {
             if (method_exists($refObj, 'CMSEditLink')) {
                 $fields->insertBefore(new KapostLogLinkField('CMSEditLink', _t('KapostBridgeLogViewer.REFERENCED_OBJECT', '_Referenced Object'), $refObj->CMSEditLink(), _t('KapostBridgeLogViewer.VIEW_REFERENCED_OBJECT', '_View Referenced Object')), 'RequestData');
             } else {
                 if ($refObj instanceof File) {
                     $refObjLink = Controller::join_links(LeftAndMain::config()->url_base, AssetAdmin::config()->url_segment, 'EditForm/field/File/item', $refObj->ID, 'edit');
                     $fields->insertBefore(new KapostLogLinkField('CMSEditLink', _t('KapostBridgeLogViewer.REFERENCED_OBJECT', '_Referenced Object'), $refObjLink, _t('KapostBridgeLogViewer.VIEW_REFERENCED_OBJECT', '_View Referenced Object')), 'RequestData');
                 }
             }
         }
     } else {
         $fields = new FieldList();
     }
     $form = new CMSForm($this, 'EditForm', $fields, new FieldList());
     $form->setResponseNegotiator($this->getResponseNegotiator());
     $form->addExtraClass('cms-edit-form center');
     $form->setAttribute('data-layout-type', 'border');
     $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
     $form->setAttribute('data-pjax-fragment', 'CurrentForm');
     $form->setHTMLID('Form_EditForm');
     if ($record) {
         $form->loadDataFrom($record);
     }
     return $form;
 }
コード例 #10
0
 public function updateCMSFields(FieldList $fields)
 {
     $fields->removeByName(array('Lat', 'Lng'));
     // Adds Lat/Lng fields for viewing in the CMS
     $compositeField = CompositeField::create();
     $compositeField->push($overrideField = CheckboxField::create('LatLngOverride', 'Override Latitude and Longitude?'));
     $overrideField->setDescription('Check this box and save to be able to edit the latitude and longitude manually.');
     if ($this->owner->Lng && $this->owner->Lat) {
         $googleMapURL = 'http://maps.google.com/?q=' . $this->owner->Lat . ',' . $this->owner->Lng;
         $googleMapDiv = '<div class="field"><label class="left" for="Form_EditForm_MapURL_Readonly">Google Map</label><div class="middleColumn"><a href="' . $googleMapURL . '" target="_blank">' . $googleMapURL . '</a></div></div>';
         $compositeField->push(LiteralField::create('MapURL_Readonly', $googleMapDiv));
     }
     if ($this->owner->LatLngOverride) {
         $compositeField->push(TextField::create('Lat', 'Lat'));
         $compositeField->push(TextField::create('Lng', 'Lng'));
     } else {
         $compositeField->push(ReadonlyField::create('Lat_Readonly', 'Lat', $this->owner->Lat));
         $compositeField->push(ReadonlyField::create('Lng_Readonly', 'Lng', $this->owner->Lng));
     }
     if ($this->owner->hasExtension('Addressable')) {
         // If using addressable, put the fields with it
         $fields->addFieldToTab('Root.Address', ToggleCompositeField::create('Coordinates', 'Coordinates', $compositeField));
     } else {
         if ($this->owner instanceof SiteTree) {
             // If SIteTree but not using Addressable, put after 'Metadata' toggle composite field
             $fields->insertAfter($compositeField, 'ExtraMeta');
         } else {
             $fields->addFieldToTab('Root.Main', ToggleCompositeField::create('Coordinates', 'Coordinates', $compositeField));
         }
     }
 }
 public function updateCMSFields(FieldList $fields)
 {
     $extFields = self::$db;
     $fields->removeByName(array_keys($extFields));
     if (!$this->owner->WordpressID) {
         return;
     }
     $compositeFields = array();
     foreach ($extFields as $name => $type) {
         $value = $this->owner->getField($name);
         $compositeFields[$name] = ReadonlyField::create($name . '_Readonly', FormField::name_to_label($name), $value);
     }
     if ($compositeFields) {
         $wordpressCompositeField = ToggleCompositeField::create('WordpressCompositeField', 'Wordpress', $compositeFields)->setHeadingLevel(4);
         if ($fields->fieldByName('Metadata')) {
             $fields->insertBefore($wordpressCompositeField, 'Metadata');
         } else {
             if ($fields->fieldByName('Root')) {
                 $fields->addFieldToTab('Root.Main', $wordpressCompositeField);
             } else {
                 $fields->push($wordpressCompositeField);
             }
         }
     }
 }
コード例 #12
0
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // Main Content tab
     // Carousel tab
     $carouselItemsGrid = null;
     // Manay to many relations can only be established if we have an id. So put a place holder instead of a grid if this is a new object.
     if ($this->ID == 0) {
         $carouselItemsGrid = TextField::create("CarouselItems", "Carousel Items")->setDisabled(true)->setValue("Page must be saved once before adding Carousel Items.");
     } else {
         $carouselItemsGrid = new GridField('CarouselItems', 'Carousel', $this->CarouselItems()->sort('Archived'), GridFieldConfig_RelationEditor::create());
         $carouselItemsGridUploadComponent = new GridFieldBulkUpload("Image");
         $carouselItemsGridUploadComponent->setUfSetup("setFolderName", $this->ImageFolder("carousel"));
         $carouselItemsGrid->setModelClass('CarouselItem')->getConfig()->addComponent($carouselItemsGridUploadComponent)->addComponent(new GridFieldOrderableRows("SortID"));
     }
     $fields->addFieldToTab('Root.Carousel', $carouselItemsGrid);
     // Links
     $fields->addFieldToTab('Root.Links', new TreeDropdownField('LearnMorePageID', 'Page to link the "Learn More" button to:', 'SiteTree'));
     $fields->addFieldToTab('Root.Links', new TextField('LearnMoreButtonText', 'Text to display on the "Learn More" button:', 'SiteTree'));
     $quickLinksGrid = new GridField('Quicklinks', 'Quicklinks', $this->Quicklinks(), GridFieldConfig_RelationEditor::create());
     $quickLinksGrid->setModelClass('Quicklink');
     $quickLinksFieldGroup = FieldGroup::create($quickLinksGrid)->setTitle('Quick Links');
     $quickLinksFieldGroup->setName("QuicklinkGroup");
     $fields->addFieldToTab('Root.Links', $quickLinksFieldGroup);
     $fields->removeByName('Translations');
     $fields->removeByName('Import');
     $fields->addFieldToTab('Root.Features', ToggleCompositeField::create('FeatureOne', _t('SiteTree.FeatureOne', 'Feature One'), array(new TextField('FeatureOneTitle', 'Title'), new DropdownField('FeatureOneCategory', 'Category', singleton('ExpressHomePage')->dbObject('FeatureOneCategory')->enumValues()), new HTMLEditorField('FeatureOneContent', 'Content'), new TreeDropdownField('FeatureOneLinkID', 'Page to link to', 'SiteTree'), new TextField('FeatureOneButtonText', 'Button text')))->setHeadingLevel(3));
     $fields->addFieldToTab('Root.Features', ToggleCompositeField::create('FeatureTwo', _t('SiteTree.FeatureTwo', 'Feature Two'), array(new TextField('FeatureTwoTitle', 'Title'), new DropdownField('FeatureTwoCategory', 'Category', singleton('ExpressHomePage')->dbObject('FeatureTwoCategory')->enumValues()), new HTMLEditorField('FeatureTwoContent', 'Content'), new TreeDropdownField('FeatureTwoLinkID', 'Page to link to', 'SiteTree'), new TextField('FeatureTwoButtonText', 'Button text')))->setHeadingLevel(3));
     return $fields;
 }
コード例 #13
0
 public function updateCMSFields(FieldList $fields)
 {
     $fields->removeByName('SocialNavLinks');
     // Setup compressed postage options
     $socialnav_fields = ToggleCompositeField::create('SocialNavFields', 'Social Nav', array(GridField::create('SocialNavLinks', '', $this->owner->SocialNavLinks(), GridFieldConfig_RecordEditor::create())));
     // Add config sets
     $fields->addFieldToTab('Root.Main', $socialnav_fields);
 }
コード例 #14
0
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     //we use ToggleCompositeFields instead of tabs. it looks cleaner and 'lite'
     $fields->addFieldToTab("Root.Main", ToggleCompositeField::create('Options', _t('Page.OPTIONS', 'Options'), array(CheckboxField::create('ShowInMenus', _t('Page.SHOWREGULARMENU', 'Show in regular Menu')), $tabBehaviour = new Tab('Settings', new DropdownField("ClassName", $this->fieldLabel('ClassName'), $this->getClassDropdown()), $parentTypeSelector = new CompositeField(new OptionsetField("ParentType", _t("SiteTree.PAGELOCATION", "Page location"), array("root" => _t("SiteTree.PARENTTYPE_ROOT", "Top-level page"), "subpage" => _t("SiteTree.PARENTTYPE_SUBPAGE", "Sub-page underneath a parent page"))), $parentIDField = new TreeDropdownField("ParentID", $this->fieldLabel('ParentID'), 'SiteTree', 'ID', 'MenuTitle')))))->setHeadingLevel(4), 'Metadata');
     $fields->removeByName("ExtraMeta");
     return $fields;
 }
コード例 #15
0
 /**
  * This method holds the functionality to complete the oauth flow through the CMS
  *
  * @param $fields FieldList
  **/
 public function updateCMSFields(FieldList $fields)
 {
     // Remove fields that may have been added elsewhere.
     $fields->removeByName("FacebookUser");
     $fields->removeByName("FacebookUserID");
     $fields->removeByName("FacebookAccessToken");
     // Add our new fields.
     $fields->addFieldsToTab("Root.Main", ToggleCompositeField::create('FacebookUser', 'Facebook User', array(TextField::create("FacebookUserID", "User ID"), TextField::create("FacebookAccessToken", "Access Token")))->setHeadingLevel(4));
 }
コード例 #16
0
 /**
  * @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;
 }
 public function updateCMSFields(FieldList $fields)
 {
     $fields->addFieldToTab('Root.Main', UploadField::create('Logo')->setFolderName('logos'));
     $footer_fields = ToggleCompositeField::create('FoooterInfo', 'Footer', array(HTMLEditorField::create('FooterContent', 'Content to appear in footer')->setRows(15)->addExtraClass('stacked')))->setHeadingLevel(4);
     $contact_fields = ToggleCompositeField::create('ContactInfo', 'Contact Info.', array(TextAreaField::create('ContactAddress', $this->owner->fieldLabel('ContactAddress')), TextField::create('ContactEmail', $this->owner->fieldLabel('ContactEmail')), TextField::create('ContactPhone', $this->owner->fieldLabel('ContactPhone')), TextAreaField::create('MiscContactInfo', $this->owner->fieldLabel('MiscContactInfo')), TextAreaField::create('MapHTML', "HTML to be loaded for mapping info")))->setHeadingLevel(4);
     $theme_custom_fields = ToggleCompositeField::create('CustomTheme', 'Theme Customisation', array(TextField::create('CustomMainBackground', $this->owner->fieldLabel('CustomMainBackground')), TextField::create('CustomBodyBackground', $this->owner->fieldLabel('CustomBodyBackground')), TextField::create('CustomHeadBackground', $this->owner->fieldLabel('CustomHeadBackground')), TextField::create('CustomFootBackground', $this->owner->fieldLabel('CustomFootBackground')), TextField::create('CustomMaxWidth', $this->owner->fieldLabel('CustomMaxWidth'))))->setHeadingLevel(4);
     $fields->addFieldToTab('Root.Main', $footer_fields);
     $fields->addFieldToTab('Root.Main', $contact_fields);
     $fields->addFieldToTab('Root.Main', $theme_custom_fields);
 }
コード例 #18
0
 /**
  * @param FieldList $fields
  */
 public function updateCMSFields(FieldList $fields)
 {
     /** =========================================
          * @var TextareaField $address
         ===========================================*/
     if (!$this->owner->TwitterCardType) {
         $this->owner->TwitterCardType = 'summary_large_image';
     }
     $fields->addFieldToTab('Root.Main', ToggleCompositeField::create('Twitter Graph', 'Twitter Card', array(LiteralField::create('', '<h2>&nbsp;&nbsp;&nbsp;Twitter Card <img style="position:relative;top:4px;left 4px;" src="' . Director::absoluteBaseURL() . 'twitter-card-meta/images/twitter.png"></h2>'), TextField::create('TwitterCreator', 'Creator Handle')->setAttribute('placeholder', 'e.g @username')->setRightTitle('Twitter account name for the author/creator (Will default to site handle)'), OptionsetField::create('TwitterCardType', 'Twitter Card Type', array('summary_large_image' => 'summary with large image', 'summary' => 'summary'), 'summary_large_image')->setRightTitle('Choose which type of twitter card you would like this page to share as.'), TextField::create('TwitterTitle', 'Twitter Card Title')->setAttribute('placeholder', 'e.g Description Of Page Content')->setRightTitle('Twitter title to to display on the Twitter card'), TextareaField::create('TwitterDescription', '')->setRightTitle('Twitter card description goes here, automatically defaults to the content summary'), UploadField::create('TwitterImage', 'Twitter Card Image')->setRightTitle('Will default too the first image in the WYSIWYG editor or banner image if left blank'))));
 }
コード例 #19
0
 /**
  * This method holds the functionality to complete the oauth flow through the CMS
  *
  * @param $fields FieldList
  **/
 public function updateCMSFields(FieldList $fields)
 {
     // Remove fields that may have been added elsewhere.
     $fields->removeByName("TwitterUser");
     $fields->removeByName("TwitterScreenName");
     $fields->removeByName("TwitterUserID");
     $fields->removeByName("TwitterAccessToken");
     $fields->removeByName("TwitterAccessSecret");
     // Add our new fields.
     $fields->push(ToggleCompositeField::create('TwitterUser', 'Twitter User', array(TextField::create("TwitterScreenName", "Screen Name"), TextField::create("TwitterUserID", "User ID"), TextField::create("TwitterAccessToken", "Access Token"), PasswordField::create("TwitterAccessSecret", "Access Secret")))->setHeadingLevel(4));
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // Embargo
     $embargo = ToggleCompositeField::create('Embargo', 'Embargo', array(DateField::create('Starts', 'Allow participation from')->setRightTitle('Optional. If left blank, participation starts when page is published')->setConfig('showcalendar', true), DateField::create('Expires', 'Until')->setRightTitle('Optional. If left blank, participation will end when page is unpublished.')->setConfig('showcalendar', true)))->setStartClosed(false);
     $fields->addFieldToTab('Root.FormOptions', $embargo, 'SubmitButtonText');
     // Reports
     $config = GridFieldConfig_RecordEditor::create();
     $reports = GridField::create('Reports', 'Reports', $this->Reports(), $config);
     $fields->addFieldToTab('Root.Reports', $reports);
     return $fields;
 }
コード例 #21
0
 /**
  * Updates the CMS fields of the extended object.
  *
  * @param FieldList $fields
  */
 public function updateCMSFields(FieldList $fields)
 {
     // Create Moderno Tab Set:
     $fields->addFieldToTab('Root', TabSet::create('Moderno', _t('ModernoConfigExtension.MODERNO', 'Moderno')));
     // Create Colors Tab:
     $fields->findOrMakeTab('Root.Moderno.Colors', _t('ModernoConfigExtension.COLORS', 'Colors'));
     // Create Colors Fields:
     $fields->addFieldsToTab('Root.Moderno.Colors', array(ColorField::create('ModernoHighlightColor', _t('ModernoConfigExtension.HIGHLIGHTCOLOR', 'Highlight color')), ColorField::create('ModernoLogoBkgColor', _t('ModernoConfigExtension.LOGOBACKGROUNDCOLOR', 'Logo background color')), ColorField::create('ModernoLinkColor', _t('ModernoConfigExtension.LINKCOLOR', 'Link color')), ColorField::create('ModernoProfileLinkColor', _t('ModernoConfigExtension.PROFILELINKCOLOR', 'Profile link color'))));
     // Create Branding Tab:
     $fields->findOrMakeTab('Root.Moderno.Branding', _t('ModernoConfigExtension.BRANDING', 'Branding'));
     // Create Branding Fields:
     $fields->addFieldsToTab('Root.Moderno.Branding', array(TextField::create('ModernoApplicationName', _t('ModernoConfigExtension.APPLICATIONNAME', 'Application name')), TextField::create('ModernoApplicationLink', _t('ModernoConfigExtension.APPLICATIONLINK', 'Application link')), ToggleCompositeField::create('ModernoLogoToggle', _t('ModernoConfigExtension.LOGOIMAGETOGGLETITLE', 'Logo Image'), array(UploadField::create('ModernoLogoImage', _t('ModernoConfigExtension.LOGOIMAGE', 'Logo image'))->setAllowedFileCategories('image')->setFolderName(self::get_asset_path()), FieldGroup::create(_t('ModernoConfigExtension.DIMENSIONSINPIXELS', 'Dimensions (in pixels)'), array(TextField::create('ModernoLogoImageWidth', '')->setAttribute('placeholder', _t('ModernoConfigExtension.WIDTH', 'Width')), LiteralField::create('ModernoLogoImageBy', '<i class="fa fa-times by"></i>'), TextField::create('ModernoLogoImageHeight', '')->setAttribute('placeholder', _t('ModernoConfigExtension.HEIGHT', 'Height')))), DropdownField::create('ModernoLogoImageResize', _t('ModernoConfigExtension.RESIZEMETHOD', 'Resize method'), self::get_resize_methods())->setEmptyString(' '), CheckboxField::create('ModernoHideSiteName', _t('ModernoConfigExtension.HIDESITENAME', 'Hide site name')), CheckboxField::create('ModernoSupportRetina', _t('ModernoConfigExtension.SUPPORTRETINADEVICES', 'Support Retina devices')))), ToggleCompositeField::create('ModernoLoadingToggle', _t('ModernoConfigExtension.LOADINGIMAGETOGGLETITLE', 'Loading Image'), array(UploadField::create('ModernoLoadingImage', _t('ModernoConfigExtension.LOADINGIMAGE', 'Loading image'))->setAllowedFileCategories('image')->setFolderName(self::get_asset_path()), FieldGroup::create(_t('ModernoConfigExtension.DIMENSIONSINPIXELS', 'Dimensions (in pixels)'), array(TextField::create('ModernoLoadingImageWidth', '')->setAttribute('placeholder', _t('ModernoConfigExtension.WIDTH', 'Width')), LiteralField::create('ModernoLoadingImageBy', '<i class="fa fa-times by"></i>'), TextField::create('ModernoLoadingImageHeight', '')->setAttribute('placeholder', _t('ModernoConfigExtension.HEIGHT', 'Height')))), DropdownField::create('ModernoLoadingImageResize', _t('ModernoConfigExtension.RESIZEMETHOD', 'Resize method'), self::get_resize_methods())->setEmptyString(' ')))));
 }
コード例 #22
0
 public function updateCMSFields(FieldList $fields)
 {
     // Slides
     $config = GridFieldConfig_RecordEditor::create();
     if (class_exists('GridFieldSortableRows')) {
         $config->addComponent(new GridFieldSortableRows('SortOrder'));
     }
     $config->removeComponentsByType('GridFieldAddExistingAutocompleter');
     $config->removeComponentsByType('GridFieldDeleteAction');
     $config->addComponent(new GridFieldDeleteAction(false));
     $SlidesField = GridField::create('Slides', 'Slides', $this->owner->Slides()->sort('SortOrder'), $config);
     $fields->addFieldsToTab('Root.Slides', array(HeaderField::create('SliderHD', 'Slides', 3), $SlidesField, ToggleCompositeField::create('ConfigHD', 'Slider Settings', array(CheckboxField::create('Animate', 'Animate automatically'), DropdownField::create('Animation', 'Animation option', $this->owner->dbObject('Animation')->enumValues()), CheckboxField::create('Loop', 'Loop the carousel'), CheckboxField::create('ThumbnailNav', 'Thumbnail Navigation')))));
 }
コード例 #23
0
 public function updateCMSFields(FieldList $fields)
 {
     $fields->addFieldToTab("Root.Main", TextField::create("BusinessName"));
     $fields->addFieldToTab("Root.Main", TextField::create("StreetAddress"));
     $fields->addFieldToTab("Root.Main", TextField::create("City"));
     $fields->addFieldToTab("Root.Main", TextField::create("Province"));
     $fields->addFieldToTab("Root.Main", TextField::create("PostalCode"));
     $fields->addFieldToTab("Root.Main", TextField::create("PhoneNumber"));
     $fields->addFieldToTab("Root.Main", TextField::create("FaxNumber"));
     $fields->addFieldToTab("Root.Main", EmailField::create("MainEmail", 'Main Contact Email'));
     $fields->addFieldToTab("Root.Main", EmailField::create("SiteEmail", 'Email for Contact Forms'));
     $fields->addFieldToTab("Root.Main", UploadField::create("Logo"));
     $socialField = ToggleCompositeField::create("SocialGroup", "Social Media", array(TextField::create("Twitter", 'Twitter User Name')->setDescription('User Name WITHOUT the at symobole (@) '), TextField::create("FacebookURL", 'Facebook URL'), TextField::create("LinkedInURL", 'LinkedIn URL'), TextField::create("GooglePlusURL", 'Google+ URL'), TextField::create("PinterestURL", 'Pinterest URL'), TextField::create("YouTubeURL", 'YouTube URL'), TextField::create("InstagramURL", 'Instagram URL'), TextField::create("TumblrURL", 'Tumblr URL')));
     $fields->addFieldToTab("Root.Main", $socialField);
 }
コード例 #24
0
    public function getCMSFields()
    {
        $fields = parent::getCMSFields();
        $fields->removeByName('Order');
        $fields->removeByName('Title');
        $fields->removeByName('ProcessStages');
        $fields->removeByName('StopStages');
        if ($this->ID > 0) {
            $stops = new GridField('StopStages', 'Stopping Points', $this->StopStages(), GridFieldConfig_RelationEditor::create());
            $stopGroup = new ToggleCompositeField('StopStages', 'Stopping points in this process', array(LiteralField::create('StopDescription', '<p class="message info">Create all stops for this process. You can then link to these stops from within any stages you create.</p>'), $stops));
            $stopGroup->setHeadingLevel(5);
        } else {
            $stopGroup = LiteralField::create('NoStopDescription', '<p class="message info">Save this process to add stages and stop stages</p>');
        }
        $fields->addFieldToTab('Root.Main', $processSteps = new CompositeField($title = new TextField('Title', 'Title'), $stopGroup));
        $title->addExtraClass('process-noborder');
        $processSteps->addExtraClass('process-step');
        $fields->insertBefore(new LiteralField('StageTitle', '<h3 class="process-info-header">
				<span class="step-label">
					<span class="flyout">1</span><span class="arrow"></span>
					<span class="title">Process details</span>
				</span>
			</h3>'), 'Title');
        if ($this->ID > 0) {
            $fields->addFieldToTab('Root.Main', $processSteps = new CompositeField(new GridField('ProcessStages', 'Process Stages', $this->ProcessStages(), $processStages = GridFieldConfig_RelationEditor::create())));
            $processStages->addComponent(new GridFieldSortableRows('Order'));
            $processSteps->addExtraClass('process-step');
            $fields->insertBefore(new LiteralField('StageTitle', '<h3 class="process-info-header">
					<span class="step-label">
						<span class="flyout">2</span><span class="arrow"></span>
						<span class="title">Stages of this process</span>
					</span>
				</h3>'), 'ProcessStages');
        }
        return $fields;
    }
コード例 #25
0
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByname('ParentID');
     $fields->removeByname('MapLocationHelp');
     $fields->removeByname('Address');
     $fields->removeByname('PostCode');
     $fields->removeByname('Latitude');
     $fields->removeByname('Longitude');
     $fields->removeByname('ZoomLevel');
     $fields->removeByname('Content');
     if ($this->ID) {
         $fields->addFieldToTab("Root.Main", HtmlEditorField::create("Content", "Content to be displayed with this map")->addExtraClass('stacked')->setRows(15));
         $config_fields = ToggleCompositeField::create('MapConfig', 'Configuration Options', array(LiteralField::create('MapLocationHelp', '<p class="field">Set EITHER an address / post code OR latitude / longitude to generate a map</p>'), TextAreaField::create("Address"), TextField::create("PostCode", "Post Code"), TextField::create("Latitude"), TextField::create("Longitude"), NumericField::create("ZoomLevel", "Zoom (1 = world, 20 = close)")))->setHeadingLevel(4);
         $fields->addFieldToTab('Root.Main', $config_fields);
     }
     return $fields;
 }
コード例 #26
0
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // Main Content tab
     $fields->addFieldToTab('Root.Main', new TreeDropdownField('LearnMorePageID', 'Page to link the "Learn More" button to:', 'SiteTree'), 'Metadata');
     // Carousel tab
     $gridField = new GridField('CarouselItems', 'Carousel', $this->CarouselItems()->sort('Archived'), GridFieldConfig_RelationEditor::create());
     $gridField->setModelClass('CarouselItem');
     $fields->addFieldToTab('Root.Carousel', $gridField);
     $gridField = new GridField('Quicklinks', 'Quicklinks', $this->Quicklinks(), GridFieldConfig_RelationEditor::create());
     $gridField->setModelClass('Quicklink');
     $fields->addFieldToTab('Root.Quicklinks', $gridField);
     $fields->removeByName('Translations');
     $fields->removeByName('Import');
     $fields->addFieldToTab('Root.Features', ToggleCompositeField::create('FeatureOne', _t('SiteTree.FeatureOne', 'Feature One'), array(new TextField('FeatureOneTitle', 'Title'), new DropdownField('FeatureOneCategory', 'Category', singleton('ExpressHomePage')->dbObject('FeatureOneCategory')->enumValues(), '', null, 'none'), new HTMLEditorField('FeatureOneContent', 'Content'), new TreeDropdownField('FeatureOneLinkID', 'Page to link to', 'SiteTree'), new TextField('FeatureOneButtonText', 'Button text')))->setHeadingLevel(3));
     $fields->addFieldToTab('Root.Features', ToggleCompositeField::create('FeatureTwo', _t('SiteTree.FeatureTwo', 'Feature Two'), array(new TextField('FeatureTwoTitle', 'Title'), new DropdownField('FeatureTwoCategory', 'Category', singleton('ExpressHomePage')->dbObject('FeatureTwoCategory')->enumValues(), '', null, 'none'), new HTMLEditorField('FeatureTwoContent', 'Content'), new TreeDropdownField('FeatureTwoLinkID', 'Page to link to', 'SiteTree'), new TextField('FeatureTwoButtonText', 'Button text')))->setHeadingLevel(3));
     return $fields;
 }
 public function getCMSFields($params = null)
 {
     Requirements::css(DATACHANGE_PATH . '/css/datachange-tracker.css');
     $fields = FieldList::create(ToggleCompositeField::create('Details', 'Details', array(ReadonlyField::create('ChangeType', 'Type of change'), ReadonlyField::create('ClassType', 'Record Class'), ReadonlyField::create('ClassID', 'Record ID'), ReadonlyField::create('ObjectTitle', 'Record Title'), ReadonlyField::create('Created', 'Modification Date'), ReadonlyField::create('Stage', 'Stage'), ReadonlyField::create('User', 'User', $this->getMemberDetails()), ReadonlyField::create('CurrentURL', 'URL'), ReadonlyField::create('Referer', 'Referer'), ReadonlyField::create('RemoteIP', 'Remote IP'), ReadonlyField::create('Agent', 'Agent')))->setStartClosed(false)->addExtraClass('datachange-field'), ToggleCompositeField::create('RawData', 'Raw Data', array(ReadonlyField::create('Before'), ReadonlyField::create('After'), ReadonlyField::create('GetVars'), ReadonlyField::create('PostVars')))->setStartClosed(false)->addExtraClass('datachange-field'));
     if (strlen($this->Before)) {
         $before = Object::create($this->ClassType, unserialize($this->Before), true);
         $after = Object::create($this->ClassType, unserialize($this->After), true);
         $diff = DataDifferencer::create($before, $after);
         $diffed = $diff->diffedData();
         $diffText = '';
         $changedFields = array();
         foreach ($diffed->toMap() as $field => $prop) {
             $changedFields[] = $readOnly = ReadonlyField::create('ChangedField' . $field, $field, $prop);
             $readOnly->dontEscape = true;
             $readOnly->addExtraClass('datachange-field');
         }
         $fields->insertBefore(ToggleCompositeField::create('FieldChanges', 'Changed Fields', $changedFields)->setStartClosed(false)->addExtraClass('datachange-field'), 'RawData');
     }
     $fields = $fields->makeReadonly();
     return $fields;
 }
コード例 #28
0
 public function getEditForm($id = null, $fields = null)
 {
     $form = parent::getEditForm($id, $fields);
     $member = \Member::currentUser();
     if (!$member) {
         return $form;
     }
     $actions = $form->Actions();
     $fields = $form->Fields();
     $fields->removeByName('BackupTokens');
     $two_factor_fields = [\CheckboxField::create('Has2FA', 'Enable Two Factor Authentication', $member->Has2FA)];
     if ($member->Has2FA) {
         $two_factor_fields[] = \LiteralField::create('SecurityWarning', '<p>The button below reveals your security token for scanning and any backup tokens you may have. ' . 'Please reveal them only when no one else is observing your screen.');
         $two_factor_fields[] = \ToggleCompositeField::create('SecurityTokens', 'Security tokens', [\LiteralField::create('PrintableTOTPToken', sprintf('<div id="PrintableTOTPToken" class="field readonly">' . '<label class="left" for="Form_EditForm_PrintableTOTPToken">TOTP Token</label>' . '<div class="middleColumn">' . '<span id="Form_EditForm_PrintableTOTPToken" class="readonly">%s<br />' . '<img src="%s" width=175 height=175 /></span>' . '</div></div>', $member->getPrintableTOTPToken(), $member->generateQRCode())), \LiteralField::create('DisplayBackupTokens', '<div id="DisplayBackupTokens" class="field readonly">' . '<p><b>Backup Tokens:</b> Please copy these and keep in a safe place.</p>' . implode('<br />', $member->BackupTokens()->column('Value')) . '</div>')]);
     }
     $fields->addFieldsToTab('Root.TwoFactorAuthentication', $two_factor_fields);
     if ($member->Has2FA) {
         $actions->push(\FormAction::create('regenerate_backup_tokens')->setTitle('Create new two-factor backup tokens')->addExtraClass('ss-ui-action-constructive')->addExtraClass('ss-ui-action-destructive'));
     }
     return $form;
 }
コード例 #29
0
 public function updateCMSFields(FieldList $fields)
 {
     $fields->removeByName('Metadata');
     /* split keywords onto new lines for easy editing */
     $this->owner->setField('MetaKeywords', $this->keywordsOnNewLine());
     $advancedFields = array();
     $ExtraMetaFields = array();
     array_push($advancedFields, new HeaderField('SeoHdr', 'Search Engine Optimization', 2));
     if (!$this->owner->canCreate()) {
         $fields->removeByName('URLSegment');
         $fields->removeByName('MenuTitle');
         $fields->removeByName('Title');
         array_push($advancedFields, new LiteralField('TitleDescription', '<p class="metatitle" id="Form_EditForm_MetaTitleStats"></p>'));
         array_push($advancedFields, new TextField('MetaTitle', 'Meta Title', $this->owner->Title));
     }
     array_push($advancedFields, new LiteralField('StatsDescription', '<p class="metastats" id="Form_EditForm_MetaDescriptionStats"></p>'));
     array_push($advancedFields, $metaFieldDesc = new TextareaField('MetaDescription', 'Meta Description'));
     /* add class to prevent newlines */
     $metaFieldDesc->addExtraClass('noenter');
     $metaFieldDesc->setRightTitle(_t('SiteTree.METADESCHELP', "Search engines use this content for displaying search results."));
     array_push($ExtraMetaFields, $metaKeywordsDesc = new TextareaField('MetaKeywords', 'Meta Keywords'));
     $metaKeywordsDesc->setRightTitle(_t('SiteTree.METAKEYWHELP', "Keywords are now ignored by most of the major search engines."));
     array_push($ExtraMetaFields, $metaFieldExtra = new TextareaField("ExtraMeta", 'Custom Meta Tags'));
     $metaFieldExtra->setRightTitle(_t('SiteTree.METAEXTRAHELP', "HTML tags for additional meta information. For example &lt;meta name=\"customName\" content=\"your custom content here\" /&gt;"));
     $MetaStuff = ToggleCompositeField::create('MetaStuff', 'Additional Metadata', $ExtraMetaFields)->setHeadingLevel(5);
     array_push($advancedFields, $MetaStuff);
     if ($depTab = $fields->fieldByName('Root.Dependent')) {
         $dependencyArr = array();
         foreach ($depTab as $item) {
             array_push($dependencyArr, $item);
         }
         $dependencyPages = ToggleCompositeField::create('Dependencies', $depTab->Title(), $dependencyArr)->setHeadingLevel(5);
         array_push($advancedFields, $dependencyPages);
         $fields->removeByName('Dependent');
     }
     $fields->addFieldsToTab('Root.Advanced', $advancedFields);
     $seoTab = $fields->findOrMakeTab('Root.Advanced');
     $seoTab->addExtraClass('tab-to-right');
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName('ParentConfigID');
     // Setup Payment Gateway type
     $payments = ClassInfo::subclassesFor('CommercePaymentMethod');
     // Remove parent class from list
     unset($payments['CommercePaymentMethod']);
     // Check if any payment types have been hidden and unset
     foreach ($payments as $payment_type) {
         if ($payment_type::$hidden) {
             unset($payments[$payment_type]);
         }
     }
     $classname_field = DropdownField::create('ClassName', 'Type of Payment', $payments)->setHasEmptyDefault(true)->setEmptyString('Select Gateway');
     $fields->addFieldToTab('Root.Main', $classname_field);
     if ($this->ID) {
         $fields->addFieldToTab("Root.Main", TextField::create('Summary', 'Summary message to appear on website'));
         $fields->addFieldToTab("Root.Main", TextField::create('URL', 'Payment gateway URL'));
         $fields->addFieldToTab("Root.Main", CheckboxField::create('Default', 'Default payment method?'));
         $fields->addFieldToTab("Root.Main", TextareaField::create('GatewayMessage', 'Message to appear when user user is directed to payment provider'));
         $fields->addFieldToTab("Root.Main", HTMLEditorField::create("PaymentInfo", "Message to appear on payment summary page"));
         // Setup response URL field
         $callback_url = Controller::join_links(Director::absoluteBaseURL(), Payment_Controller::config()->url_segment, "callback", $this->ID);
         // Setup completed URL
         $complete_url = Controller::join_links(Director::absoluteBaseURL(), Payment_Controller::config()->url_segment, "complete");
         // Setup error URL
         $error_url = Controller::join_links(Director::absoluteBaseURL(), Payment_Controller::config()->url_segment, "complete", "error");
         $url_field = ToggleCompositeField::create("PaymentURLS", "Payment integration URLs", FieldList::create(ReadonlyField::create('ResponseURL', 'Response URL')->setValue($callback_url), ReadonlyField::create('CompletedURL', 'Completed URL')->setValue($complete_url), ReadonlyField::create('ErrorURL', 'Error URL')->setValue($error_url)));
         $fields->addFieldToTab("Root.Main", $url_field);
     } else {
         $fields->removeByName('URL');
         $fields->removeByName('Summary');
         $fields->removeByName('Default');
         $fields->removeByName('GatewayMessage');
         $fields->removeByName('PaymentInfo');
     }
     return $fields;
 }