public function updateCMSFields(FieldList $fields)
 {
     $fields->addFieldToTab('Root', Tab::create("GoogleAnalytics", _t('GoogleAnalyzer.TABTITLE', "Google Analytics")));
     $fields->addFieldToTab("Root.GoogleAnalytics", TabSet::create("Stats", _t('GoogleAnalyzer.STATS', "Stats")));
     $fields->addFieldToTab('Root.GoogleAnalytics.Stats', Tab::create("Performance", _t('GoogleAnalyzer.PERFORMANCE', "Performance")));
     $fields->addFieldToTab("Root.GoogleAnalytics.Stats.Performance", new GooglePerformanceChart($this->owner));
 }
コード例 #2
0
 /**
  * getCMSFields
  * Construct the FieldList used in the CMS. To provide a
  * smarter UI we don't use the scaffolding provided by
  * parent::getCMSFields.
  * 
  * @return FieldList
  */
 public function getCMSFields()
 {
     Requirements::css('torindul-silverstripe-shop/css/LeftAndMain.css');
     //Create the FieldList and push the Root TabSet on to it.
     $fields = FieldList::create($root = TabSet::create('Root', Tab::create("Main", HeaderField::create("Add/Edit Currency"), CompositeField::create(DropdownField::create("Enabled", "Enable Currency?", array("1" => "Yes", "2" => "No"))->setRightTitle($this->SystemCreated == 1 ? "DISABLED: You can not disable the default currency." : "Select the country this zone applies to.")->setDisabled($this->SystemCreated == 1 ? true : false), TextField::create("Title", "Currency Name")->setRightTitle("i.e. Great British Pound."), TextField::create("Code", "Currency Code")->setRightTitle("i.e. GBP, USD, EUR."), TextField::create("ExchangeRate", "Exchange Rate")->setRightTitle("i.e. Your new currency is USD, a conversion rate of 1.53 may apply against the local currency."), TextField::create("Symbol", "Currency Symbol")->setRightTitle("i.e. £, \$, €."), DropdownField::create("SymbolLocation", "Symbol Location", array("1" => "On the left, i.e. \$1.00", "2" => "On the right, i.e. 1.00\$", "3" => "Display the currency code instead, i.e. 1 USD."))->setRightTitle("Where should the currency symbol be placed?"), TextField::create("DecimalSeperator", "Decimal Separator")->setRightTitle("What decimal separator does this currency use?"), TextField::create("ThousandsSeparator", "Thousands Separator")->setRightTitle("What thousands separator does this currency use?"), NumericField::create("DecimalPlaces", "Decimal Places")->setRightTitle("How many decimal places does this currency use?")))));
     return $fields;
 }
コード例 #3
0
 /**
  * getCMSFields
  * Construct the FieldList used in the CMS. To provide a
  * smarter UI we don't use the scaffolding provided by
  * parent::getCMSFields.
  * 
  * @return FieldList
  */
 public function getCMSFields()
 {
     Requirements::css('torindul-silverstripe-shop/css/LeftAndMain.css');
     //Create the FieldList and push the Root TabSet on to it.
     $fields = FieldList::create($root = TabSet::create('Root', Tab::create("Main", HeaderField::create($this->SystemName), CompositeField::create(TextField::create("Title", "Friendly Name")->setRightTitle("This is the name your customers would see against this courier."), DropdownField::create("Enabled", "Enable this courier?", array("0" => "No", "1" => "Yes"))->setEmptyString("(Select one)")->setRightTitle("Can customers use this courier?")))));
     return $fields;
 }
コード例 #4
0
 /**
  * getCMSFields
  * Construct the FieldList used in the CMS. To provide a
  * smarter UI we don't use the scaffolding provided by
  * parent::getCMSFields.
  * 
  * @return FieldList
  */
 public function getCMSFields()
 {
     Requirements::css('torindul-silverstripe-shop/css/LeftAndMain.css');
     //Create the FieldList and push the Root TabSet on to it.
     $fields = FieldList::create($root = TabSet::create('Root', Tab::create("Main", HeaderField::create("Add/Edit Order Status"), CompositeField::create(TextField::create("Title", "Friendly Name")->setRightTitle("The name of your custom order status. i.e. Pending, Awaiting Stock."), TextareaField::create("Content", "Friendly Description")->setRightTitle("This will be shown to your customers. What do you wish to tell them about this status?")))));
     return $fields;
 }
 /**
  * @return FieldList 
  */
 public function getCMSFields()
 {
     // Get NotifiedOn implementors
     $types = ClassInfo::implementorsOf('NotifiedOn');
     $types = array_combine($types, $types);
     unset($types['NotifyOnThis']);
     if (!$types) {
         $types = array();
     }
     array_unshift($types, '');
     // Available keywords
     $keywords = $this->getKeywords();
     if (count($keywords)) {
         $availableKeywords = '<div class="field"><div class="middleColumn"><p><u>Available Keywords:</u> </p><ul><li>$' . implode('</li><li>$', $keywords) . '</li></ul></div></div>';
     } else {
         $availableKeywords = "Available keywords will be shown if you select a NotifyOnClass";
     }
     // Identifiers
     $identifiers = $this->config()->get('identifiers');
     if (count($identifiers)) {
         $identifiers = array_combine($identifiers, $identifiers);
     }
     $fields = FieldList::create();
     $relevantMsg = 'Relevant for (note: this notification will only be sent if the context of raising the notification is of this type)';
     $fields->push(TabSet::create('Root', Tab::create('Main', DropdownField::create('Identifier', _t('SystemNotification.IDENTIFIER', 'Identifier'), $identifiers), TextField::create('Title', _t('SystemNotification.TITLE', 'Title')), TextField::create('Description', _t('SystemNotification.DESCRIPTION', 'Description')), DropdownField::create('NotifyOnClass', _t('SystemNotification.NOTIFY_ON_CLASS', $relevantMsg), $types), TextField::create('CustomTemplate', _t('SystemNotification.TEMPLATE', 'Template (Optional)'))->setAttribute('placeholder', $this->config()->get('default_template')), LiteralField::create('AvailableKeywords', $availableKeywords))));
     if ($this->config()->html_notifications) {
         $fields->insertBefore(HTMLEditorField::create('NotificationHTML', _t('SystemNotification.TEXT', 'Text')), 'AvailableKeywords');
     } else {
         $fields->insertBefore(TextareaField::create('NotificationText', _t('SystemNotification.TEXT', 'Text')), 'AvailableKeywords');
     }
     return $fields;
 }
コード例 #6
0
 /**
  * getCMSFields
  * Construct the FieldList used in the CMS. To provide a
  * smarter UI we don't use the scaffolding provided by
  * parent::getCMSFields.
  * 
  * @return FieldList
  */
 public function getCMSFields()
 {
     Requirements::css('torindul-silverstripe-shop/css/LeftAndMain.css');
     //Create the FieldList and push the Root TabSet on to it.
     $fields = FieldList::create($root = TabSet::create('Root', Tab::create("Main", HeaderField::create("Add/Edit Tax Class"), CompositeField::create(TextField::create("Title", "Class Name")->setRightTitle("i.e. Zero Rate, Standard Rate.")))));
     return $fields;
 }
コード例 #7
0
 /**
  * getCMSFields
  * Construct the FieldList used in the CMS. To provide a
  * smarter UI we don't use the scaffolding provided by
  * parent::getCMSFields.
  * 
  * @return FieldList
  */
 public function getCMSFields()
 {
     Requirements::css('torindul-silverstripe-shop/css/LeftAndMain.css');
     //Create the FieldList and push the Root TabSet on to it.
     $fields = FieldList::create($root = TabSet::create('Root', Tab::create("Main", HeaderField::create("Add/Edit Tax Zone"), CompositeField::create(DropdownField::create("Enabled", "Enable this zone?", array("1" => "Yes", "2" => "No"))->setRightTitle($this->SystemCreated == 1 && $this->exists() ? "DISABLED: You can not disable the default tax zone." : "If enabled your store will use the rates defined in this zone for customers in the selected country.")->setDisabled($this->SystemCreated == 1 && $this->exists() ? true : false), !$this->exists() ? CountryDropdownField::create("Title", "Country")->setRightTitle($this->SystemCreated == 1 && $this->exists() ? "DISABLED: You can not select a country as this zone applies to all countries." : "Select the country this zone applies to.")->setDisabled($this->SystemCreated == 1 && $this->exists() ? true : false) : "", $this->exists() ? GridField::create("TaxZones_TaxRates", "Tax Rates within the '" . $this->Title . "' Tax Zone", $this->TaxRates(), GridFieldConfig_RecordEditor::create()) : ""))));
     return $fields;
 }
コード例 #8
0
 public function updateCMSFields(FieldList $fields)
 {
     foreach (['primary', 'secondary'] as $lower) {
         $upper = ucfirst($lower);
         $config = $this->owner->config()->get("{$lower}_gallery");
         if (is_null($config) || isset($config['enabled']) && $config['enabled'] === false) {
             continue;
         }
         $config['title'] = isset($config['title']) ? $config['title'] : "{$upper} Gallery";
         $config['folder'] = isset($config['folder']) ? $config['folder'] : "{$upper}-Gallery-Images";
         $GridFieldConfig = new GridFieldConfig_RecordEditor();
         $GridFieldConfig->removeComponentsByType('GridFieldAddNewButton');
         $GridFieldConfig->addComponent($bulkUploadConfig = new GridFieldBulkUpload());
         $GridFieldConfig->addComponent(new GridFieldSortableRows('SortOrder'));
         $GridFieldConfig->addComponent(new GridFieldGalleryTheme('Image'));
         $bulkUploadConfig->setUfSetup('setFolderName', "Images/{$config['folder']}");
         $GridField = new GridField("{$upper}GalleryGridField", $config['title'], $this->owner->{"{$upper}GalleryImages"}(), $GridFieldConfig);
         /** @var TabSet $rootTab */
         //We need to repush Metadata to ensure it is the last tab
         $rootTab = $fields->fieldByName('Root');
         $rootTab->push($tab = Tab::create("{$upper}Gallery"));
         if ($rootTab->fieldByName('Metadata')) {
             $metaChildren = $rootTab->fieldByName('Metadata')->getChildren();
             $rootTab->removeByName('Metadata');
             $rootTab->push(Tab::create('Metadata')->setChildren($metaChildren));
         }
         $tab->setTitle($config['title']);
         $fields->addFieldToTab("Root.{$upper}Gallery", $GridField);
     }
 }
コード例 #9
0
 public function updateCMSFields(FieldList $fields)
 {
     $fields->insertBefore($shoptab = Tab::create('Shop', 'Shop'), 'Access');
     $fields->addFieldsToTab("Root.Shop", TabSet::create("ShopTabs", $maintab = Tab::create("Main", TreeDropdownField::create('TermsPageID', _t("ShopConfig.TERMSPAGE", 'Terms and Conditions Page'), 'SiteTree'), TreeDropdownField::create("CustomerGroupID", _t("ShopConfig.CUSTOMERGROUP", "Group to add new customers to"), "Group"), UploadField::create('DefaultProductImage', _t('ShopConfig.DEFAULTIMAGE', 'Default Product Image'))), $countriestab = Tab::create("Countries", CheckboxSetField::create('AllowedCountries', _t('ShopConfig.ALLOWED_COUNTRIES', 'Allowed Ordering and Shipping Countries'), self::config()->iso_3166_country_codes))));
     $fields->removeByName("CreateTopLevelGroups");
     $countriestab->setTitle(_t('ShopConfig.ALLOWED_COUNTRIES_TAB_TITLE', "Allowed Countries"));
 }
コード例 #10
0
 /**
  * Get the fields that are sent to the CMS. In
  * your extensions: updateCMSFields($fields)
  *
  * @return FieldList
  */
 public function getCMSFields()
 {
     /** @var FieldList $fields */
     $fields = FieldList::create(TabSet::create('Root', Tab::create('Main'), Tab::create('Settings')));
     $fields->addFieldToTab('Root.Settings', TextField::create('GoogleFontAPI'));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
コード例 #11
0
 /**
  * @todo fix sortorder
  *
  * @param FieldList $fields
  */
 public function updateCMSFields(FieldList $fields)
 {
     /** Setup new Root Fieldlist */
     $fields->removeByName('Main');
     $owner = $this->owner;
     /** Add the fields */
     $fields->addFieldsToTab('Root', Tab::create('Main', _t('Tag.MAIN', 'Main'), $text = TextField::create('Title', $owner->fieldLabel('Title')), $html = HTMLEditorField::create('Description', $owner->fieldLabel('Description')), $uplo = UploadField::create('Impression', $owner->fieldLabel('Impression'))));
 }
コード例 #12
0
 public function createNext7DaysTab()
 {
     $sevenDaysTab = Tab::create('Next7Days', 'Next 7 Days', $days = TabSet::create('Days'));
     for ($i = 0; $i < 7; $i++) {
         $data = $this->getFieldsForEventDay($i);
         $days->push(Tab::create("Plus{$i}Days", $data['TabTitle'])->setChildren($data['Fields']));
     }
     return $sevenDaysTab;
 }
コード例 #13
0
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $gfConfig = GridFieldConfig_relationEditor::create();
     $gfConfig->removeComponentsByType('GridFieldDeleteAction')->removeComponentsByType('GridFieldDetailForm')->addComponents(new VersionedGridFieldDetailForm());
     $articles = Versioned::get_by_stage('NewsArticle', 'Stage');
     $fields->insertAfter(Tab::create('Articles'), 'Main');
     $fields->addFieldToTab('Root.Articles', GridField::create('Children', 'Articles', $articles, $gfConfig));
     return $fields;
 }
 /**
  * Adjusts the media form to include the controls and ui for Vidyard
  * @param {Form} $form Form to adjust
  */
 public function updateMediaForm(Form $form)
 {
     $apiKey = Vidyard::config()->api_key;
     if (!empty($apiKey)) {
         $numericLabelTmpl = '<span class="step-label"><span class="flyout">%d</span><span class="arrow"></span><strong class="title">%s</strong></span>';
         $tabs = $form->Fields()->offsetGet(1)->fieldByName('MediaFormInsertMediaTabs');
         $tabs->push(Tab::create('FromVidyard', _t('VidyardInsertMedia.FROM_VIDYARD', '_From Vidyard'), CompositeField::create(new LiteralField('headerVidyard', '<h4>' . sprintf($numericLabelTmpl, '1', _t('VidyardInsertMedia.ADD_VIDEO', '_Add Video')) . '</h4>'), TextField::create('VideoURL', 'http://')->addExtraClass('remoteurl')->setDescription(_t('VidyardInsertMedia.ADD_VIDEO_DESC', '_The url you should use in this field is the sharing page, you can also use some of the settings pages for the video in Vidyard')), new LiteralField('addVidyard', '<button class="action ui-action-constructive ui-button field add-url add-vidyard" data-icon="addMedia">' . _t('VidyardInsertMedia.ADD_VIDEO', '_Add Video') . '</button>'))->addExtraClass('content ss-uploadfield'))->addExtraClass('htmleditorfield-from-web')->setTabSet($tabs)->setForm($form));
         Requirements::javascript(VIDYARD_BASE . '/javascript/VidyardInsertMedia.js');
     }
 }
コード例 #15
0
 /**
  * getCMSFields
  * Construct the FieldList used in the CMS. To provide a
  * smarter UI we don't use the scaffolding provided by
  * parent::getCMSFields.
  * 
  * @return FieldList
  */
 public function getCMSFields()
 {
     Requirements::css('torindul-silverstripe-shop/css/LeftAndMain.css');
     //Product Item not yet created
     $select_product_item = Tab::create("Item", HeaderField::create("Add Order Item"), CompositeField::create(DropdownField::create("OriginalProductID", "Select Product", Product::get()->sort("Title ASC")->map())->setEmptyString("(Select a product)")));
     //Product Item has been created
     $edit_product_item = Tab::create("Item", HeaderField::create("Order Item"), CompositeField::create(ReadonlyField::create("Title", "Product")->setRightTitle("You will need to remove this item and add another should you wish to change the product."), ReadonlyField::create("SKU", "SKU"), FieldGroup::create(NumericField::create("Price", "Cost per item"), DropdownField::create("Discounted", "Is this the sale price?", array("0" => "No", "1" => "Yes")), NumericField::create("Quantity", "Quantity ordered"))->setTitle("Pricing (" . Product::getDefaultCurrency() . ") "), ReadonlyField::create("SubTotal", "Subtotal (" . Product::getDefaultCurrency() . ")", StoreCurrency::convertToCurrency($this->Price * $this->Quantity)), ReadonlyField::create("TAX", $this->TaxClassName . " (" . Product::getDefaultCurrency() . ")", $this->calculateItemTax())->setRightTitle($this->TaxCalculation == 1 ? "Subtotal is inclusive of this tax." : "Subtotal is exclusive of this tax."), ReadonlyField::create("Total", "Total (" . Product::getDefaultCurrency() . ")", $this->TaxCalculation == 1 ? StoreCurrency::convertToCurrency($this->Price * $this->Quantity) : StoreCurrency::convertToCurrency($this->Price * $this->Quantity + $this->calculateItemTax()))));
     //Create the FieldList and push the either of the above Tabs to the Root TabSet based on if Product Item exists yet or not.
     $fields = FieldList::create($root = TabSet::create('Root', $this->exists() ? $edit_product_item : $select_product_item));
     return $fields;
 }
コード例 #16
0
ファイル: Customer.php プロジェクト: vinstah/body
 /**
  * Add some fields for managing Members in the CMS.
  * 
  * @return FieldList
  */
 public function getCMSFields()
 {
     $fields = new FieldList();
     $fields->push(new TabSet('Root', Tab::create('Customer')));
     $password = new ConfirmedPasswordField('Password', null, null, null, true);
     $password->setCanBeEmpty(true);
     if (!$this->ID) {
         $password->showOnClick = false;
     }
     $fields->addFieldsToTab('Root.Customer', array(new TextField('FirstName'), new TextField('Surname'), new EmailField('Email'), new ConfirmedPasswordField('Password'), $password));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
コード例 #17
0
 /**
  * @param FieldList $actions
  */
 public function updateCMSActions(FieldList $actions)
 {
     if ($this->canBeReviewedBy(Member::currentUser())) {
         Requirements::css("contentreview/css/contentreview.css");
         $reviewTitle = LiteralField::create("ReviewContentNotesLabel", "<label class=\"left\" for=\"Form_EditForm_ReviewNotes\">" . _t("ContentReview.CONTENTREVIEW", "Content due for review") . "</label>");
         $ReviewNotes = LiteralField::create("ReviewNotes", "<textarea class=\"no-change-track\" id=\"Form_EditForm_ReviewNotes\" name=\"ReviewNotes\" placeholder=\"" . _t("ContentReview.COMMENTS", "(optional) Add comments...") . "\" class=\"text\"></textarea>");
         $quickReviewAction = FormAction::create("savereview", _t("ContentReview.MARKREVIEWED", "Mark as reviewed"))->setAttribute("data-icon", "pencil")->setAttribute("data-text-alternate", _t("ContentReview.MARKREVIEWED", "Mark as reviewed"));
         $allFields = CompositeField::create($reviewTitle, $ReviewNotes, $quickReviewAction)->addExtraClass('review-notes field');
         $reviewTab = Tab::create('ReviewContent', $allFields);
         $reviewTab->addExtraClass('contentreview-tab');
         $actions->fieldByName('ActionMenus')->insertBefore($reviewTab, 'MoreOptions');
     }
 }
コード例 #18
0
    public function afterUpdateCMSFields(FieldList $fields)
    {
        self::$runs++;
        /** @var ToggleCompositeField $metaDataChildren */
        $metaDataChildren = $fields->fieldByName('Root.Main.Metadata');
        $length = $this->owner->config()->MetaDescriptionLength ?: $this->MetaDescriptionLength;
        $metaDataChildren->fieldByName('MetaDescription')->setAttribute('maxlength', $length);
        $children = array_merge([$metaTitle = TextField::create('MetaTitle')], $metaDataChildren->getChildren()->toArray());
        $fields->removeFieldFromTab('Root.Main', 'Metadata');
        $fields->addFieldToTab('Root', Tab::create('Metadata'), 'Content');
        //Add META Title tag to METADATA
        $fields->addFieldsToTab('Root.Metadata', $children);
        $metaTitle->setDescription('Displayed as the tab/window name; Also displayed in search engine result listings as the page title.<br />
									Falls back to the Primary Heading field if not provided.');
    }
コード例 #19
0
 /**
  * getCMSFields
  * Construct the FieldList used in the CMS. To provide a
  * smarter UI we don't use the scaffolding provided by
  * parent::getCMSFields.
  * 
  * @return FieldList
  */
 public function getCMSFields()
 {
     Requirements::css('torindul-silverstripe-shop/css/LeftAndMain.css');
     //Create the FieldList and push the Root TabSet on to it.
     $fields = FieldList::create($root = TabSet::create('Root', Tab::create("Main", HeaderField::create("Add/Edit Payment"))));
     /* 
      * If a Payment Gateway/Method hasn't been selected yet, prompt for one.
      * Otherwise, show the form fields for the database fields in the Order_Payment DataObject.
      */
     if (!$this->exists()) {
         $fields->addFieldsToTab("Root.Main", array(CompositeField::create(DropdownField::create("ClassName", "Payment Method", Gateway::create()->getGateways($this->Order(), true))->setRightTitle("Which payment method did the customer pay with?")->setEmptyString("(Select one)"))));
     } else {
         $fields->addFieldsToTab("Root.Main", array(CompositeField::create(DateField::create("Date", "Payment Date")->setConfig('dateformat', 'dd-MM-yyyy')->setConfig('showcalendar', true)->setRightTitle('To open a pop-up calendar click on the text field above.'), DropdownField::create("Status", "Payment Status", array("Pending" => "Pending", "Processing" => "Processing", "Denied" => "Denied", "Completed" => "Completed", "Refunded" => "Refunded")), FieldGroup::create("Amounts", NumericField::create("Amount", "Payment Amount")->setRightTitle("How much was paid?"), DropdownField::create("Currency", "Payment Currency", DataObject::get("StoreCurrency", "(`Enabled`=1)")->map("ID", "Code"))->setRightTitle("In which currency was the payment?")))));
     }
     return $fields;
 }
コード例 #20
0
 public function getCMSFields()
 {
     $fields = FieldList::create(TabSet::create('Root', Tab::create('Main')));
     // Link to event
     if ($this->EventID) {
         $fields->addFieldToTab('Root.Main', LiteralField::create('EventEditLink', '<div class="field">' . '<label class="left">Linked Event: </label>' . $this->Event()->getDataAdminEditAnchorTag() . '</div>'));
     }
     // Display readonly fields
     if ($this->isLocked()) {
         foreach ($this->db() as $field => $type) {
             $fields->addFieldToTab('Root.Main', ReadonlyField::create($field));
         }
     } else {
         $fields->addFieldToTab('Root.Main', DropdownField::create('State', 'State', $this->dbObject('State')->enumValues()));
     }
     return $fields;
 }
コード例 #21
0
 /**
  * Create CMS fields for cms viewing and editing orders
  */
 public function getCMSFields()
 {
     $fields = FieldList::create(TabSet::create('Root', Tab::create('Main')));
     $fs = "<div class=\"field\">";
     $fe = "</div>";
     $parts = array(DropdownField::create("Status", _t('Order.db_Status', "Status"), self::get_order_status_options()), LiteralField::create('Customer', $fs . $this->renderWith("OrderAdmin_Customer") . $fe), LiteralField::create('Addresses', $fs . $this->renderWith("OrderAdmin_Addresses") . $fe), LiteralField::create('Content', $fs . $this->renderWith("OrderAdmin_Content") . $fe));
     if ($this->Notes) {
         $parts[] = LiteralField::create('Notes', $fs . $this->renderWith("OrderAdmin_Notes") . $fe);
     }
     $fields->addFieldsToTab('Root.Main', $parts);
     $this->extend('updateCMSFields', $fields);
     if ($payments = $fields->fieldByName("Root.Payments.Payments")) {
         $fields->removeByName("Payments");
         $fields->insertAfter($payments, "Content");
         $payments->addExtraClass("order-payments");
     }
     return $fields;
 }
 public function updateCMSFields(FieldList $fields)
 {
     /** @var GridFieldConfig $gridConfig */
     $gridConfig = GridFieldConfig::create();
     $gridConfig->addComponent(new GridFieldButtonRow('before'))->addComponent(new GridFieldAddNewButton('buttons-before-left'))->addComponent(new GridFieldToolbarHeader())->addComponent(new GridFieldSortableHeader())->addComponent(new GridFieldSortableRows('SortOrder'))->addComponent($dataColumns = new GridFieldDataColumns())->addComponent(new GridFieldEditButton())->addComponent(new GridFieldDeleteAction())->addComponent(new GridFieldDetailForm());
     $dataColumns->setDisplayFields(['Title' => 'Question', 'Answer.Summary' => 'Answer Preview']);
     /** @var TabSet $rootTab */
     //We need to repush Metadata to ensure it is the last tab
     $rootTab = $fields->fieldByName('Root');
     $rootTab->push(Tab::create('FaqSegments'));
     if ($rootTab->fieldByName('Metadata')) {
         $metaChildren = $rootTab->fieldByName('Metadata')->getChildren();
         $rootTab->removeByName('Metadata');
         $rootTab->push(Tab::create('Metadata')->setChildren($metaChildren));
     }
     $GridField = GridField::create('FaqSegments', 'FAQs', $this->owner->Faqs(), $gridConfig);
     $fields->addFieldToTab('Root.FaqSegments', $GridField);
     return $fields;
 }
コード例 #23
0
 protected function updateFields($fields)
 {
     $fields->removeByName('SocialFeed_Profiles');
     $fields->removeByName('SocialFeed_Limit');
     $fields->removeByName('CacheHours');
     $fields->removeByName('AddThis');
     $fields->addFieldToTab('Root', \Tab::create($this->tab ?: 'SocialPlatforms', $this->tab ?: _t('SocialFeed.SOCIAL_PLATFORMS', 'Social Platforms'), $gf = \GridField::create('SocialFeed_Profiles', _t('SocialFeed.PROFILES', 'Profiles'), $this->owner->SocialFeed_Profiles(), $config = \GridFieldConfig_RecordEditor::create()), \NumericField::create('SocialFeed_Limit', _t('SocialFeed.LIMIT', 'Limit'))->setDescription(_t('SocialFeed.DESC-LIMIT', 'Set how many to retrieve at a time')), \NumericField::create('CacheHours', _t('SocialFeed.CACHE', 'Cache for'))->setDescription(_t('SocialFeed.DESC-CACHE', 'Set how many hours the results from the various platforms are stored in cache for'))->setAttribute('placeholder', 6), \TextField::create('AddThis', _t('SocialFeed.ADDTHIS', 'Add This Profile'))->setDescription(_t('SocialFeed.DESC-ADDTHIS', 'AddThis Profile ID used for sharing (format: <strong>ra-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</strong>)'))->setAttribute('placeholder', singleton('SocialFeed_Profile')->setting('AddThis'))));
     $config->removeComponentsByType('GridFieldAddNewButton')->addComponent(new \GridFieldAddExistingSearchButton('buttons-before-right'))->addComponent(new \GridFieldDeleteAction(true), 'GridFieldDeleteAction')->addComponent(new \GridFieldAddNewMultiClass());
     if ($columns = $config->getComponentByType('GridFieldDataColumns')) {
         $displayColumns = $columns->getDisplayFields($gf);
         if (isset($displayColumns['Enabled'])) {
             $displayColumns['Enabled'] = _t('SocialFeed.ENABLED_GLOBALLY', 'Show (Globally)');
             $columns->setDisplayFields($displayColumns);
             $columns->setFieldFormatting(['Enabled' => function ($value, $record) {
                 return $value ? '<span class="ui-button-icon-primary ui-icon btn-icon-accept boolean-yes"></span>' : '<span class="ui-button-icon-primary ui-icon btn-icon-decline boolean-no"></span>';
             }]);
         }
     }
     if ($detailForm = $config->getComponentByType('GridFieldDetailForm')) {
         $self = $this->owner;
         $oldCallback = $detailForm->getItemEditFormCallback();
         $detailForm->setItemEditFormCallback(function ($form, $controller) use($self, $detailForm, $oldCallback) {
             if ($oldCallback) {
                 $oldCallback($form, $controller);
             }
             if (isset($controller->record)) {
                 $record = $controller->record;
             } elseif ($form->Record) {
                 $record = $form->Record;
             } else {
                 $record = null;
             }
             if ($record) {
                 $record->Parent = $self;
                 foreach (array_intersect($record->many_many(), \ClassInfo::ancestry($self)) as $relation => $type) {
                     $form->Fields()->removeByName($relation);
                 }
                 $record->setEditFormWithParent($self, $form, $controller);
             }
         });
     }
 }
コード例 #24
0
 /**
  * getCMSFields
  * Construct the FieldList used in the CMS. To provide a
  * smarter UI we don't use the scaffolding provided by
  * parent::getCMSFields.
  * 
  * @return FieldList
  */
 public function getCMSFields()
 {
     Requirements::css('torindul-silverstripe-shop/css/LeftAndMain.css');
     $customer = $this->Customer();
     $fields = FieldList::create(Tabset::create("Root", Tabset::create("Order", Tab::create("CustomerDetails", HeaderField::create("Customer Selection"), CompositeField::create(DropdownField::create("CustomerID", $this->exists() ? "Customer" : "Select a Customer", Customer::get()->sort(array('Surname' => 'ASC', 'FirstName' => 'ASC'))->map())->setEmptyString("(Select a Customer)")->setRightTitle($this->exists() ? "To change the customer against this order select the new customer above (when editing from the\n\t\t\t\t\t\t\t\t'Store Orders' screen) and click save." : "Which customer is this order for?")), $this->exists() ? HeaderField::create("Customer Details") : null, $this->exists() ? CompositeField::create(ReadonlyField::create("Customer.FirstName", "First Name", $customer->FirstName), ReadonlyField::create("Customer.Surname", "Surname", $customer->Surname), ReadonlyField::create("Customer.CompanyName", "Company", $customer->CompanyName), ReadonlyField::create("Customer.Landline", "Landline Number", $customer->LandlineNumber), ReadonlyField::create("Customer.Mobile", "Mobile Number", $customer->MobileNumber)) : ""), Tab::create("OrderDetails", HeaderField::create("Order Details"), CompositeField::create(DropdownField::create("Status", "Order Status", Order_Statuses::get()->map()), DropdownField::create("BillingAddressID", "Billing Address", DataObject::get("Customer_AddressBook", "(`CustomerID`=" . $this->Customer()->ID . ")")->map())->setRightTitle("Customers' billing address.")->setEmptyString("(Select one)"), DropdownField::create("ShippingAddressID", "Shipping Address", DataObject::get("Customer_AddressBook", "(`CustomerID`=" . $this->Customer()->ID . ")")->map())->setRightTitle("Customers' shipping address.")->setEmptyString("(Select one)")), HeaderField::create("Order Items (Basket)"), CompositeField::create($items = GridField::create("OrderItems", "", $this->Order_Items(), GridFieldConfig_RecordEditor::create()), ReadonlyField::create("SubTotal", "Basket Total (" . Product::getDefaultCurrency() . ")", $this->calculateSubTotal())), HeaderField::create("Shipping"), CompositeField::create(FieldGroup::create(DropdownField::create("Courier", "Courier", $this->getCouriers($this->ID))->setRightTitle("Which courier is being used for this order?")->setEmptyString("(Select one)"), Textfield::create("TrackingNo", "Tracking Number (Optional)")->setRightTitle("If the shipment has a tracking number, enter it here.")), ReadonlyField::create("Shipping", "Shipping Total (" . Product::getDefaultCurrency() . ")", $this->calculateShippingTotal())), HeaderField::create("Order Totals"), CompositeField::create(FieldGroup::create("Tax (" . Product::getDefaultCurrency() . ")", ReadonlyField::create("ProductTaxInclusive", "Product Tax (Inclusive)", $this->calculateProductTax(1))->setRightTitle("Basket total is inclusive of this tax."), ReadonlyField::create("ProductTaxExclusive", "Product Tax (Exclusive)", $this->calculateProductTax(2))->setRightTitle("Basket total is exclusive of this tax."), ReadonlyField::create("ShippingTax", "Shipping Tax", $this->calculateShippingTax($this->calculateShippingTotal()))->setRightTitle(StoreSettings::get_settings()->TaxSettings_ShippingInclusiveExclusive == 1 ? "Shipping price is inclusive of this tax." : "Shipping price is exclusive of this tax.")), FieldGroup::create("Final Totals (" . Product::getDefaultCurrency() . ")", ReadonlyField::create("Total", "Final Total", $this->calculateOrderTotal()), ReadonlyField::create("TotalPayments", "Total Payments", $this->calculatePaymentTotal()), ReadonlyField::create("OutstandingBalance", "Outstanding Balance", $this->calculateRemainingBalance()))), HeaderField::create("Payments"), CompositeField::create($items = GridField::create("OrderPayments", "", $this->Order_Payment(), GridFieldConfig_RecordEditor::create()))), Tab::create("OrderComments", HeaderField::create("Order Comments"), CompositeField::create(ReadonlyField::create("CustomerComments", "Customer Comments")->setRightTitle("These are the comments of this customer."), TextareaField::create("AdminComments", "Admin Comments")->setRightTitle("Only store admins can see these comments"))), Tab::create("OrderEmails", HeaderField::create("Order Emails"), CompositeField::create($items = GridField::create("Order_Emails", "", $this->Order_Emails(), GridFieldConfig_RecordViewer::create()))))));
     //If record doesn't exist yet, hide certain tabs.
     !$this->exists() ? $fields->RemoveFieldsFromTab("Root.Order", array("OrderDetails", "OrderComments", "OrderEmails")) : null;
     /* 
      * If record exists, and order is unpaid show warning message to prevent shipment of unpaid orders.
      * Otherwise show a success message.
      */
     if ($this->exists() && $this->calculateRemainingBalance() > 0) {
         $alert = new LiteralField("OrderPayment_LiteralField", "<div class=\"literal-field field\">\n\t\t\t\t\t<div class=\"message error\">\n\t\t\t\t\t\t<strong>ORDER REMAINS UNPAID</strong> - This order has an outstanding balance of " . Product::getDefaultCurrency() . $this->calculateRemainingBalance() . ". If the customer has paid then the\n\t\t\t\t\t\t payment gateway may not have provided a payment status yet.\n\t\t\t\t\t</div>\n\t\t\t\t</div>");
         $fields->addFieldToTab("Root.Order", $alert, "Status");
     } elseif ($this->exists() && $this->calculateRemainingBalance() == 0) {
         $alert = new LiteralField("OrderPayment_LiteralField", "<div class=\"literal-field field\">\n\t\t\t\t\t<div class=\"message good\">\n\t\t\t\t\t\t<strong>BALANCE PAID</strong> - This balance of this order has been paid. You may now prepare and \n\t\t\t\t\t\tdispatch the order items below.\n\t\t\t\t\t</div> \n\t\t\t\t</div>");
         $fields->addFieldToTab("Root.Order", $alert, "Status");
     }
     return $fields;
 }
    public function updateCMSFields(FieldList $fields)
    {
        //change Page Name label to Primary Heading - H1 - Only if the title hasn't already been changed
        /** @var TextField $titleField */
        $titleField = $fields->dataFieldByName('Title');
        if ($titleField->Title() == 'Page Name') {
            $fields->renameField('Title', 'Primary Heading');
        }
        //Add secondary heading - H2
        $fields->insertAfter(TextField::create('SubTitle', 'Secondary Heading'), 'Title');
        //Move meta fields to their own tab
        /** @var ToggleCompositeField $metaDataChildren */
        $metaDataChildren = $fields->fieldByName('Root.Main.Metadata');
        $children = array_merge([$metaTitle = TextField::create('MetaTitle')], $metaDataChildren->getChildren()->toArray());
        $fields->removeFieldFromTab('Root.Main', 'Metadata');
        $fields->addFieldToTab('Root', Tab::create('Metadata'), 'Content');
        //Add META Title tag to METADATA
        $fields->addFieldsToTab('Root.Metadata', $children);
        $metaTitle->setDescription('Displayed as the tab/window name; Also displayed in search engine result listings as the page title.<br />
									Falls back to the Primary Heading field if not provided.');
    }
 public function updateCMSFields(FieldList $fields)
 {
     /** @var TabSet $rootTab */
     //We need to repush Metadata to ensure it is the last tab
     $rootTab = $fields->fieldByName('Root');
     $rootTab->push($documentsTab = Tab::create('DocumentCategories'));
     if ($rootTab->fieldByName('Metadata')) {
         $metaChildren = $rootTab->fieldByName('Metadata')->getChildren();
         $rootTab->removeByName('Metadata');
         $rootTab->push(Tab::create('Metadata')->setChildren($metaChildren));
     }
     $DocumentCategoriesConfig = new GridFieldConfig_RecordEditor();
     $DocumentCategoriesConfig->addComponent(new GridFieldSortableRows('SortOrder'));
     $DocumentCategories = new GridField("DocumentCategoriesGridField", "Document Categories", $this->owner->DocumentCategories(), $DocumentCategoriesConfig);
     $fields->addFieldToTab('Root.DocumentCategories', $DocumentCategories);
     $config = $this->owner->config()->get('page_documents');
     if (is_array($config) && isset($config['title'])) {
         $documentsTab->setTitle($config['title']);
     }
     return $fields;
 }
コード例 #27
0
    /**
     * If the user is admin, he/she is able to enter the twitter keys required.
     * There is only one user active at the time. So, after the button is clicked, we don't show it again.
     * @todo fix the button to make it less ugly.
     * @param FieldList $fields 
     */
    public function updateCMSFields(FieldList $fields)
    {
        /**
         * Twitter connection (at least this one works!)
         */
        if ($this->owner->OAuthToken != '') {
            $setField = LiteralField::create('dummy', _t($this->class . '.VERIFIED', '<h5>' . _t($this->class . '.DONE', 'Already verified with Twitter') . '</h5><br />'));
        } else {
            $setField = LiteralField::create('dummy', '
				<div onclick="javascript:window.location.href =\'TwitterController/signin/\'" class="ss-ui-action-constructive ss-ui-button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary" id="" data-icon="accept" role="button" aria-disabled="false"><span class="ui-button-icon-primary ui-icon btn-icon-accept"></span><span class="ui-button-text">
		' . _t($this->class . '.VERIFY', 'Verify with Twitter') . '</span></div><br />');
        }
        $fields->addFieldToTab('Root', TabSet::create('SocialMedia', _t($this->class . '.SOCIALMEDIA', 'Social media'), Tab::create('TwitterConnect', _t($this->class . '.TWITTERTAB', 'Twitter connect'), $setField, TextField::create('TwitterAccount', _t($this->class . '.TACCOUNT', 'Twitter account')))));
        // Only admins can add a consumer key/secret combo. For security reasons ofcourse.
        if (Member::currentUser()->inGroup('administrators')) {
            $fields->addFieldsToTab('Root.SocialMedia.TwitterConnect', array(TextField::create('ConsumerKey'), TextField::create('ConsumerSecret')));
        }
        $fields->addFieldToTab('Root.SocialMedia.TwitterConnect', TextField::create('TweetText', _t($this->class . '.TWEETTEXT', 'Text to tweet. $Title will be replaced by the actual page/object title.')));
        /**
         * Facebook connection.
         */
        if ($this->owner->FBVerified) {
            $setField = LiteralField::create('dummy', _t($this->class . '.VERIFIED', '<h5>Already verified with Facebook</h5><br />'));
            $setField2 = LiteralField::create('dummy2', '
				<div onclick="javascript:window.location.href =\'FacebookController/postFacebook/\'" class="ss-ui-action-constructive ss-ui-button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary" id="" data-icon="accept" role="button" aria-disabled="false"><span class="ui-button-icon-primary ui-icon btn-icon-accept"></span><span class="ui-button-text">
		' . _t($this->class . '.VERIFYFB', 'Send a test-post') . '</span></div><br />');
        } else {
            $setField = LiteralField::create('dummy', '
				<div onclick="javascript:window.location.href =\'FacebookController/signin/\'" class="ss-ui-action-constructive ss-ui-button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary" id="" data-icon="accept" role="button" aria-disabled="false"><span class="ui-button-icon-primary ui-icon btn-icon-accept"></span><span class="ui-button-text">
		' . _t($this->class . '.VERIFYFB', 'Verify with Facebook') . '</span></div><br />');
            $setField2 = LiteralField::create('dummy2', _t($this->class . '.VERIFYFIRST', 'You need to verify before you can test!'));
        }
        $fields->addFieldToTab('Root.SocialMedia', Tab::create('FacebookConnect', _t($this->class . '.FBTab', 'Facebook connect'), $setField, $setField2, TextField::create('FBPageID', 'Facebook Page ID')));
        // Only admins can add a consumer key/secret combo. For security reasons ofcourse.
        if (Member::currentUser()->inGroup('administrators')) {
            $fields->addFieldsToTab('Root.SocialMedia.FacebookConnect', array(TextField::create('FBAppID', 'Facebook App ID'), TextField::create('FBSecret', 'Facebook secret')));
        }
        $fields->addFieldToTab('Root.SocialMedia.FacebookConnect', TextField::create('FBText', _t($this->class . '.FBTEXT', 'Text to post to Facebook. $Title will be replaced by the actual page/object title.')));
    }
コード例 #28
0
 /**
  * Constructs a FieldList for use in the CMSForm.
  *
  * @return FieldList
  */
 public function construct_cms_fields()
 {
     //Create the FieldList and push the Root TabSet on to it.
     $fields = FieldList::create($root = TabSet::create('Root', Tabset::create("Orders", Tab::create($title = "All Orders", HeaderField::create($title), CompositeField::create(GridField::create("AllOrders", "", DataObject::get("Order", "(`TempBasketID` IS NULL) AND (`Status`!='1')", "Created DESC"), GridFieldConfig_RecordEditor::create()))), Tab::create($title = "Pending", LiteralField::create("Pending_LiteralField", "<div class=\"literal-field literal-field-noborder\">\n\t\t\t\t\t\t\t\t<div class=\"message warning\">\n\t\t\t\t\t\t\t\t\t<strong>THESE ORDERS ARE UNPAID:</strong><br />\n\t\t\t\t\t\t\t\t\tThese orders have been placed but their associated payment gateway is yet to respond\n\t\t\t\t\t\t\t\t\twith a payment status. Do not process / dispatch these orders until they are\n\t\t\t\t\t\t\t\t\tmoved to another status.\n\t\t\t\t\t\t\t\t</div>\t\t\n\t\t\t\t\t\t\t</div>"), HeaderField::create($title . " Orders"), CompositeField::create(GridField::create("PendingOrders", "", DataObject::get("Order", "(`TempBasketID` IS NULL) AND (`Status`='1')", "Created DESC"), GridFieldConfig_RecordEditor::create()->removeComponentsByType("GridFieldAddNewButton")))), Tab::create($title = "Processing", HeaderField::create($title . " Orders"), CompositeField::create(GridField::create("ProcessingOrders", "", DataObject::get("Order", "(`TempBasketID` IS NULL) AND (`Status`='2')", "Created DESC"), GridFieldConfig_RecordEditor::create()->removeComponentsByType("GridFieldAddNewButton")))), Tab::create($title = "Awaiting Stock", HeaderField::create($title), CompositeField::create(GridField::create("AwaitingStockOrders", "", DataObject::get("Order", "(`TempBasketID` IS NULL) AND (`Status`='3')", "Created DESC"), GridFieldConfig_RecordEditor::create()->removeComponentsByType("GridFieldAddNewButton")))), Tab::create($title = "Completed", HeaderField::create($title), CompositeField::create(GridField::create("CompletedOrders", "", DataObject::get("Order", "(`TempBasketID` IS NULL) AND (`Status`='4')", "Created DESC"), GridFieldConfig_RecordEditor::create()->removeComponentsByType("GridFieldAddNewButton")))), Tab::create($title = "Shipped", HeaderField::create($title . " Orders"), CompositeField::create(GridField::create("ShippedOrders", "", DataObject::get("Order", "(`TempBasketID` IS NULL) AND (`Status`='5')", "Created DESC"), GridFieldConfig_RecordEditor::create()->removeComponentsByType("GridFieldAddNewButton")))), Tab::create($title = "Refunded", HeaderField::create($title . " Orders"), CompositeField::create(GridField::create("RefundedOrders", "", DataObject::get("Order", "(`TempBasketID` IS NULL) AND (`Status`='6')", "Created DESC"), GridFieldConfig_RecordEditor::create()->removeComponentsByType("GridFieldAddNewButton")))), Tab::create($title = "Part Refunded", HeaderField::create($title . " Orders"), CompositeField::create(GridField::create("PartRefundedOrders", "", DataObject::get("Order", "(`TempBasketID` IS NULL) AND (`Status`='7')", "Created DESC"), GridFieldConfig_RecordEditor::create()->removeComponentsByType("GridFieldAddNewButton")))), Tab::create($title = "Cancelled", HeaderField::create($title . " Orders"), CompositeField::create(GridField::create("CancelledOrders", "", DataObject::get("Order", "(`TempBasketID` IS NULL) AND (`Status`='8')", "Created DESC"), GridFieldConfig_RecordEditor::create()->removeComponentsByType("GridFieldAddNewButton")))), Tab::create($title = "Other Statuses", HeaderField::create("Other Status"), CompositeField::create(LiteralField::create($title = "CustomFieldsDescription", "<div class=\"literal-field literal-field-noborder\">\n\t\t\t\t\t\t\t\t\tThis table displays all orders with a custom order statuses as set in Store Settings.\n\t\t\t\t\t\t\t\t</div>"), GridField::create("CustomStatusOrders", "", DataObject::get("Order", "(`Status`>'8')", "Created DESC"), GridFieldConfig_RecordEditor::create()->removeComponentsByType("GridFieldAddNewButton")))))), HiddenField::create('ID', false, 0));
     //Tab nav in CMS is rendered through separate template
     $root->setTemplate('CMSTabSet');
     return $fields;
 }
コード例 #29
0
 public function getCMSFields()
 {
     $fields = FieldList::create(TabSet::create("Root", Tab::create("Main", TextField::create('OldURL', 'URL to redirect')->setDescription('Don\'t include domain, e.g. /old/link/'), NumericField::create('RedirectCode', 'Redirect Code'), DropdownField::create('RedirectType', 'Redirect Type', $this->dbObject('RedirectType')->enumValues()), CompositeField::create(array(HeaderField::create('InternalHeader', 'Internal Redirect', 3), TreeDropdownField::create('PageID', 'Page', 'SiteTree'), TextField::create('Action')->setDescription('Action part of the url your are redirecting to e.g. /checkout/options (options is the Action)')))->addExtraClass('internal-fields'), CompositeField::create(array(HeaderField::create('CustomHeader', 'Custom Redirect', 3), TextField::create('RedirectTo', 'Redirect To')))->addExtraClass('custom-fields'), TextField::create('Anchor')->setDescription('Anchor on the page to redirect to e.g. for anchor #bottom enter bottom (don\'t enter the hash)'))));
     Requirements::javascript(OLD_URLS_DIR . '/javascript/OldURLs.js');
     return $fields;
 }
コード例 #30
0
 /**
  * Return a {@link Form} instance allowing a user to
  * add images and flash objects to the TinyMCE content editor.
  *  
  * @return Form
  */
 public function MediaForm()
 {
     // TODO Handle through GridState within field - currently this state set too late to be useful here (during
     // request handling)
     $parentID = $this->getAttachParentID();
     $fileFieldConfig = GridFieldConfig::create()->addComponents(new GridFieldFilterHeader(), new GridFieldSortableHeader(), new GridFieldDataColumns(), new GridFieldPaginator(5), new GridFieldDeleteAction(), new GridFieldDetailForm());
     $fileField = new GridField('Files', false, null, $fileFieldConfig);
     $fileField->setList($this->getFiles($parentID));
     $fileField->setAttribute('data-selectable', true);
     $fileField->setAttribute('data-multiselect', true);
     $columns = $fileField->getConfig()->getComponentByType('GridFieldDataColumns');
     $columns->setDisplayFields(array('CMSThumbnail' => false, 'Name' => _t('File.Name')));
     $numericLabelTmpl = '<span class="step-label"><span class="flyout">%d</span><span class="arrow"></span>' . '<strong class="title">%s</strong></span>';
     $fromCMS = new CompositeField(new LiteralField('headerSelect', '<h4>' . sprintf($numericLabelTmpl, '1', _t('HtmlEditorField.FindInFolder', 'Find in Folder')) . '</h4>'), $select = TreeDropdownField::create('ParentID', "", 'Folder')->addExtraClass('noborder')->setValue($parentID), $fileField);
     $fromCMS->addExtraClass('content ss-uploadfield');
     $select->addExtraClass('content-select');
     $fromWeb = new CompositeField(new LiteralField('headerURL', '<h4>' . sprintf($numericLabelTmpl, '1', _t('HtmlEditorField.ADDURL', 'Add URL')) . '</h4>'), $remoteURL = new TextField('RemoteURL', 'http://'), new LiteralField('addURLImage', '<button class="action ui-action-constructive ui-button field add-url" data-icon="addMedia">' . _t('HtmlEditorField.BUTTONADDURL', 'Add url') . '</button>'));
     $remoteURL->addExtraClass('remoteurl');
     $fromWeb->addExtraClass('content ss-uploadfield');
     Requirements::css(FRAMEWORK_DIR . '/css/AssetUploadField.css');
     $computerUploadField = Object::create('UploadField', 'AssetUploadField', '');
     $computerUploadField->setConfig('previewMaxWidth', 40);
     $computerUploadField->setConfig('previewMaxHeight', 30);
     $computerUploadField->addExtraClass('ss-assetuploadfield');
     $computerUploadField->removeExtraClass('ss-uploadfield');
     $computerUploadField->setTemplate('HtmlEditorField_UploadField');
     $computerUploadField->setFolderName(Config::inst()->get('Upload', 'uploads_folder'));
     $tabSet = new TabSet("MediaFormInsertMediaTabs", Tab::create('FromComputer', _t('HtmlEditorField.FROMCOMPUTER', 'From your computer'), $computerUploadField)->addExtraClass('htmleditorfield-from-computer'), Tab::create('FromWeb', _t('HtmlEditorField.FROMWEB', 'From the web'), $fromWeb)->addExtraClass('htmleditorfield-from-web'), Tab::create('FromCms', _t('HtmlEditorField.FROMCMS', 'From the CMS'), $fromCMS)->addExtraClass('htmleditorfield-from-cms'));
     $tabSet->addExtraClass('cms-tabset-primary');
     $allFields = new CompositeField($tabSet, new LiteralField('headerEdit', '<h4 class="field noborder header-edit">' . sprintf($numericLabelTmpl, '2', _t('HtmlEditorField.ADJUSTDETAILSDIMENSIONS', 'Details &amp; dimensions')) . '</h4>'), $editComposite = new CompositeField(new LiteralField('contentEdit', '<div class="content-edit ss-uploadfield-files files"></div>')));
     $allFields->addExtraClass('ss-insert-media');
     $headings = new CompositeField(new LiteralField('Heading', sprintf('<h3 class="htmleditorfield-mediaform-heading insert">%s</h3>', _t('HtmlEditorField.INSERTMEDIA', 'Insert Media')) . sprintf('<h3 class="htmleditorfield-mediaform-heading update">%s</h3>', _t('HtmlEditorField.UpdateMEDIA', 'Update Media'))));
     $headings->addExtraClass('cms-content-header');
     $editComposite->addExtraClass('ss-assetuploadfield');
     $fields = new FieldList($headings, $allFields);
     $actions = new FieldList(FormAction::create('insertmedia', _t('HtmlEditorField.BUTTONINSERT', 'Insert'))->addExtraClass('ss-ui-action-constructive media-insert')->setAttribute('data-icon', 'accept')->setUseButtonTag(true), FormAction::create('insertmedia', _t('HtmlEditorField.BUTTONUpdate', 'Update'))->addExtraClass('ss-ui-action-constructive media-update')->setAttribute('data-icon', 'accept')->setUseButtonTag(true));
     $form = new Form($this->controller, "{$this->name}/MediaForm", $fields, $actions);
     $form->unsetValidator();
     $form->disableSecurityToken();
     $form->loadDataFrom($this);
     $form->addExtraClass('htmleditorfield-form htmleditorfield-mediaform cms-dialog-content');
     // TODO Re-enable once we remove $.metadata dependency which currently breaks the JS due to $.ui.widget
     // $form->setAttribute('data-urlViewfile', $this->controller->Link($this->name));
     // Allow other people to extend the fields being added to the imageform
     $this->extend('updateMediaForm', $form);
     return $form;
 }