/**
  * Returns the input fields for this widget.
  * 
  * @return FieldList
  * 
  * @author Sebastian Diel <*****@*****.**>
  * @since 23.02.2016
  */
 public function getCMSFields()
 {
     $fields = SilvercartDataObject::getCMSFields($this, 'ExtraCssClasses', false);
     $slideImagesTable = new GridField('slideImages', $this->fieldLabel('slideImages'), $this->slideImages(), SilvercartGridFieldConfig_RelationEditor::create());
     $slideImagesTable->getConfig()->removeComponentsByType('GridFieldAddNewButton');
     $slideImagesTable->getConfig()->removeComponentsByType('GridFieldAddExistingAutocompleter');
     $slideImagesTable->getConfig()->addComponent(new GridFieldDeleteAction());
     $slideImagesUploadField = new SilvercartImageUploadField('UploadslideImages', $this->fieldLabel('AddImage'));
     $slideImagesUploadField->setFolderName('Uploads/slider-images');
     $slideImagesUploadField->setRelationClassName('SilvercartImageSliderImage');
     $fields->findOrMakeTab('Root.slideImages', $this->fieldLabel('slideImages'));
     $fields->addFieldToTab('Root.slideImages', $slideImagesUploadField);
     $fields->addFieldToTab('Root.slideImages', $slideImagesTable);
     $this->getCMSFieldsSliderTab($fields);
     return $fields;
 }
 /**
  * Returns modified CMS fields for the payment modules
  *
  * @return FieldList
  */
 public function getCMSFieldsForModules()
 {
     $this->getCMSFieldsIsCalled = true;
     $tabset = new TabSet('Root');
     $fields = new FieldList($tabset);
     // --------------------------------------------------------------------
     // Common GUI elements for all payment methods
     // --------------------------------------------------------------------
     $tabBasic = new Tab('Basic', _t('SilvercartPaymentMethod.BASIC_SETTINGS', 'basic settings'));
     $translationsTab = new Tab('Translations');
     $translationsTab->setTitle(_t('SilvercartConfig.TRANSLATIONS'));
     $tabset->push($tabBasic);
     $tabset->push($translationsTab);
     $tabBasicFieldList = new FieldList();
     $tabBasic->setChildren($tabBasicFieldList);
     //multilingual fields
     $tabBasicFieldList->push(new CheckboxField('isActive', _t('SilvercartShopAdmin.PAYMENT_ISACTIVE', 'activated')));
     $tabBasicFieldList->push(new DropdownField('mode', _t('SilvercartPaymentMethod.MODE', 'mode'), array('Live' => $this->fieldLabel('modeLive'), 'Dev' => $this->fieldLabel('modeDev')), $this->mode));
     if ($this->isExtendingSilvercartPaymentMethod()) {
         $languageFields = SilvercartLanguageHelper::prepareCMSFields($this->getLanguageClassName());
         foreach ($languageFields as $languageField) {
             $tabBasicFieldList->push($languageField);
         }
     }
     $tabBasicFieldList->push(new TextField('minAmountForActivation', _t('SilvercartShopAdmin.PAYMENT_MINAMOUNTFORACTIVATION')));
     $tabBasicFieldList->push(new TextField('maxAmountForActivation', _t('SilvercartShopAdmin.PAYMENT_MAXAMOUNTFORACTIVATION')));
     $tabBasicFieldList->push(new DropdownField('orderStatus', _t('SilvercartPaymentMethod.STANDARD_ORDER_STATUS', 'standard order status for this payment method'), SilvercartOrderStatus::getStatusList()->map('Code', 'Title')->toArray()));
     $tabBasicFieldList->dataFieldByName('orderStatus')->setEmptyString(_t("SilvercartEditAddressForm.EMPTYSTRING_PLEASECHOOSE"));
     // --------------------------------------------------------------------
     // Handling cost table
     // --------------------------------------------------------------------
     $tabHandlingCosts = new Tab('HandlingCosts', _t('SilvercartPaymentMethod.HANDLINGCOSTS_SETTINGS'));
     $tabset->push($tabHandlingCosts);
     $handlingCostField = new GridField('SilvercartHandlingCosts', $this->fieldLabel('SilvercartHandlingCosts'), $this->SilvercartHandlingCosts(), SilvercartGridFieldConfig_RelationEditor::create(50));
     $tabHandlingCosts->setChildren(new FieldList($handlingCostField));
     // --------------------------------------------------------------------
     // GUI for management of logo images
     // --------------------------------------------------------------------
     $tabLogos = new Tab('Logos', _t('SilvercartPaymentMethod.PAYMENT_LOGOS', 'Payment Logos'));
     $tabset->push($tabLogos);
     $paymentLogosTable = new GridField('PaymentLogos', $this->fieldLabel('PaymentLogos'), $this->PaymentLogos(), SilvercartGridFieldConfig_RelationEditor::create());
     $paymentLogosTable->getConfig()->removeComponentsByType('GridFieldAddNewButton');
     $paymentLogosTable->getConfig()->removeComponentsByType('GridFieldAddExistingAutocompleter');
     $paymentLogosTable->getConfig()->addComponent(new GridFieldDeleteAction());
     $paymentLogosUploadField = new SilvercartImageUploadField('UploadPaymentLogos', $this->fieldLabel('AddPaymentLogos'));
     $paymentLogosUploadField->setFolderName('Uploads/payment-images');
     $tabLogos->setChildren(new FieldList(new CheckboxField('showPaymentLogos', _t('SilvercartShopAdmin.SHOW_PAYMENT_LOGOS')), $paymentLogosUploadField, $paymentLogosTable));
     // --------------------------------------------------------------------
     // GUI for access management
     // --------------------------------------------------------------------
     $tabAccessManagement = new Tab('AccessManagement', _t('SilvercartPaymentMethod.ACCESS_SETTINGS', 'Access management'));
     $tabset->push($tabAccessManagement);
     $tabsetAccessManagement = new TabSet('AccessManagementSection');
     $tabAccessManagement->push($tabsetAccessManagement);
     $tabAccessManagementBasic = new Tab('AccessManagementBasic', _t('SilvercartPaymentMethod.ACCESS_MANAGEMENT_BASIC_LABEL', 'General'));
     $tabAccessManagementGroup = new Tab('AccessManagementGroup', _t('SilvercartPaymentMethod.ACCESS_MANAGEMENT_GROUP_LABEL', 'By group(s)'));
     $tabAccessManagementUser = new Tab('AccessManagementUser', _t('SilvercartPaymentMethod.ACCESS_MANAGEMENT_USER_LABEL', 'By user(s)'));
     $tabsetAccessManagement->push($tabAccessManagementBasic);
     $tabsetAccessManagement->push($tabAccessManagementGroup);
     $tabsetAccessManagement->push($tabAccessManagementUser);
     $showOnlyForGroupsTable = new GridField('ShowOnlyForGroups', $this->fieldLabel('ShowOnlyForGroups'), $this->ShowOnlyForGroups(), SilvercartGridFieldConfig_RelationEditor::create());
     $showNotForGroupsTable = new GridField('ShowNotForGroups', $this->fieldLabel('ShowNotForGroups'), $this->ShowNotForGroups(), SilvercartGridFieldConfig_RelationEditor::create());
     $showOnlyForUsersTable = new GridField('ShowOnlyForUsers', $this->fieldLabel('ShowOnlyForUsers'), $this->ShowOnlyForUsers(), SilvercartGridFieldConfig_RelationEditor::create());
     $showNotForUsersTable = new GridField('ShowNotForUsers', $this->fieldLabel('ShowNotForUsers'), $this->ShowNotForUsers(), SilvercartGridFieldConfig_RelationEditor::create());
     $restrictionByOrderQuantityField = new TextField('orderRestrictionMinQuantity', '');
     $restrictionByOrderStatusField = new GridField('OrderRestrictionStatus', $this->fieldLabel('SilvercartOrderStatus'), $this->OrderRestrictionStatus(), SilvercartGridFieldConfig_RelationEditor::create());
     // Access management basic --------------------------------------------
     $tabAccessManagementBasic->push(new HeaderField('RestrictionLabel', _t('SilvercartPaymentMethod.RESTRICTION_LABEL') . ':', 2));
     $tabAccessManagementBasic->push(new LiteralField('separatorForActivationByOrderRestrictions', '<hr />'));
     $tabAccessManagementBasic->push(new CheckboxField('enableActivationByOrderRestrictions', _t('SilvercartPaymentMethod.ENABLE_RESTRICTION_BY_ORDER_LABEL')));
     $tabAccessManagementBasic->push(new LiteralField('RestrictionByOrderQuantityLabel', '<p>' . _t('SilvercartPaymentMethod.RESTRICT_BY_ORDER_QUANTITY') . ':</p>'));
     $tabAccessManagementBasic->push($restrictionByOrderQuantityField);
     $tabAccessManagementBasic->push(new LiteralField('RestrictionByOrderStatusLabel', '<p>' . _t('SilvercartPaymentMethod.RESTRICT_BY_ORDER_STATUS') . ':</p>'));
     $tabAccessManagementBasic->push($restrictionByOrderStatusField);
     // Access management for groups ---------------------------------------
     $tabAccessManagementGroup->push(new HeaderField('ShowOnlyForGroupsLabel', _t('SilvercartPaymentMethod.SHOW_ONLY_FOR_GROUPS_LABEL') . ':', 2));
     $tabAccessManagementGroup->push($showOnlyForGroupsTable);
     $tabAccessManagementGroup->push(new HeaderField('ShowNotForGroupsLabel', _t('SilvercartPaymentMethod.SHOW_NOT_FOR_GROUPS_LABEL') . ':', 2));
     $tabAccessManagementGroup->push($showNotForGroupsTable);
     // Access management for users ----------------------------------------
     $tabAccessManagementUser->push(new HeaderField('ShowOnlyForUsersLabel', _t('SilvercartPaymentMethod.SHOW_ONLY_FOR_USERS_LABEL') . ':', 2));
     $tabAccessManagementUser->push($showOnlyForUsersTable);
     $tabAccessManagementUser->push(new HeaderField('ShowNotForUsersLabel', _t('SilvercartPaymentMethod.SHOW_NOT_FOR_USERS_LABEL') . ':', 2));
     $tabAccessManagementUser->push($showNotForUsersTable);
     // --------------------------------------------------------------------
     // Countries
     // --------------------------------------------------------------------
     $countriesTab = new Tab('SilvercartCountries', $this->fieldLabel('SilvercartCountries'));
     $tabset->push($countriesTab);
     $countriesTable = new GridField('SilvercartCountries', $this->fieldLabel('SilvercartCountries'), $this->SilvercartCountries(), SilvercartGridFieldConfig_RelationEditor::create());
     $countriesTab->push($countriesTable);
     // --------------------------------------------------------------------
     // shipping methods
     // --------------------------------------------------------------------
     $shippingMethodsTab = new Tab('SilvercartShippingMethods', $this->fieldLabel('SilvercartShippingMethods'));
     $shippingMethodsDesc = new HeaderField('SilvercartShippingMethodsDesc', _t('SilvercartPaymentMethod.SHIPPINGMETHOD_DESC'));
     $shippingMethodsTable = new GridField('SilvercartShippingMethods', _t('SilvercartPaymentMethod.SHIPPINGMETHOD', 'shipping method'), $this->SilvercartShippingMethods(), SilvercartGridFieldConfig_RelationEditor::create(50));
     $tabset->push($shippingMethodsTab);
     $shippingMethodsTab->push($shippingMethodsDesc);
     $shippingMethodsTab->push($shippingMethodsTable);
     $this->getFieldsForChargesAndDiscounts($fields);
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
 /**
  * Adds or modifies the fields for the Images tab
  *
  * @param FieldList $fields FieldList to add fields to
  * 
  * @return void
  */
 public function getFieldsForImages($fields)
 {
     $imageGridField = $fields->dataFieldByName('SilvercartImages');
     $imageGridField->getConfig()->removeComponentsByType('GridFieldAddNewButton');
     $imageGridField->getConfig()->removeComponentsByType('GridFieldAddExistingAutocompleter');
     $imageGridField->getConfig()->addComponent(new GridFieldDeleteAction());
     $imageUploadField = new SilvercartImageUploadField('UploadSilvercartImages', $this->fieldLabel('AddSilvercartImage'));
     $imageUploadField->setFolderName('Uploads/product-images');
     $fields->addFieldToTab('Root.SilvercartImages', $imageUploadField, 'SilvercartImages');
 }
 /**
  * Returns the input fields for this widget without scaffolding
  * 
  * @return FieldList
  * 
  * @author Sascha Koehler <*****@*****.**>, Sebastian Diel <*****@*****.**>
  * @since 03.09.2012
  */
 public function getCMSFields()
 {
     $fields = new FieldList();
     $rootTabSet = new TabSet('Root');
     $basicTab = new Tab('Basic', $this->fieldLabel('BasicTab'));
     $translationTab = new Tab('Translations', $this->fieldLabel('TranslationsTab'));
     $titleField = new TextField('FrontTitle', $this->fieldLabel('FrontTitle'));
     $contentField = new TextareaField('FrontContent', $this->fieldLabel('FrontContent'), 10);
     $imageTable = new GridField('SilvercartImages', $this->fieldLabel('Images'), $this->SilvercartImages()->sort('Sort'), SilvercartGridFieldConfig_RelationEditor::create());
     $imageTable->getConfig()->removeComponentsByType('GridFieldAddNewButton');
     $imageTable->getConfig()->removeComponentsByType('GridFieldAddExistingAutocompleter');
     $imageTable->getConfig()->addComponent(new GridFieldDeleteAction());
     $imageTable->getConfig()->addComponent(new GridFieldSortableRows('Sort'));
     $imagesUploadDescription = sprintf($this->fieldLabel('SilvercartImagesDescription'), $this->getSliderHeight());
     $imagesUploadField = new SilvercartImageUploadField('UploadSilvercartImages', $this->fieldLabel('AddImage'));
     $imagesUploadField->setFolderName('Uploads/silvercart-images');
     $imagesUploadField->setDescription($imagesUploadDescription);
     $translationsTableField = new GridField('SilvercartSlidorionProductGroupWidgetLanguages', $this->fieldLabel('translations'), $this->SilvercartSlidorionProductGroupWidgetLanguages(), SilvercartGridFieldConfig_ExclusiveRelationEditor::create());
     $widgetHeightField = new TextField('widgetHeight', $this->fieldLabel('widgetHeight'));
     $speedField = new TextField('speed', $this->fieldLabel('speed'));
     $intervalField = new TextField('interval', $this->fieldLabel('interval'));
     $effectField = new DropdownField('effect', $this->fieldLabel('effect'), singleton('SilvercartSlidorionProductGroupWidget')->dbObject('effect')->enumValues(), $this->effect);
     $hoverPauseField = new CheckboxField('hoverPause', $this->fieldLabel('hoverPause'));
     $autoPlayField = new CheckboxField('autoPlay', $this->fieldLabel('autoPlay'));
     $advancedToggle = ToggleCompositeField::create('AdvancedToggle', $this->fieldLabel('AdvancedTab'), array($widgetHeightField, $speedField, $intervalField, $effectField, $hoverPauseField, $autoPlayField))->setHeadingLevel(4);
     $basicTab->push($titleField);
     $basicTab->push($contentField);
     $basicTab->push($imagesUploadField);
     $basicTab->push($imageTable);
     $basicTab->push($advancedToggle);
     $translationTab->push($translationsTableField);
     $fields->push($rootTabSet);
     $rootTabSet->push($basicTab);
     $rootTabSet->push($translationTab);
     return $fields;
 }