/**
  * Returns a LanguageDropdownField instance used as a default for form 
  * scaffolding.
  * 
  * @param string $title  Optional. Localized title of the generated instance
  * @param array  $params Optional.
  * 
  * @return FormField
  *
  * @author Sebastian Diel <*****@*****.**>
  * @since 20.03.2013
  */
 public function scaffoldFormField($title = null, $params = null)
 {
     if (is_null($title)) {
         $title = _t('SilvercartConfig.TRANSLATION');
     }
     $instance = null;
     $alreadyTranslatedLocales = array();
     $translatingClass = 'SiteTree';
     if (array_key_exists('object', $params)) {
         $translatingClass = $params['object']->ClassName;
         $instance = $params['object'];
     }
     if ($instance) {
         $alreadyTranslatedLocales = $instance->getTranslatedLocales();
         unset($alreadyTranslatedLocales[$instance->Locale]);
     }
     $localeDropdown = new LanguageDropdownField($this->name, $title, $alreadyTranslatedLocales, $translatingClass, 'Locale-Native', $instance);
     $currentLocale = Translatable::get_current_locale();
     $localesWithTitle = $localeDropdown->getSource();
     $usedLocalesWithTitle = Translatable::get_existing_content_languages('SiteTree');
     $languageList = array();
     $usedLanguageList = array();
     foreach ($localesWithTitle as $locale => $localeTitle) {
         if (is_array($localeTitle)) {
             foreach ($localeTitle as $locale2 => $title2) {
                 $title2 = SilvercartLanguageHelper::getLanguageDisplayTitle($locale2, $currentLocale);
                 if (array_key_exists($locale2, $usedLocalesWithTitle)) {
                     $usedLanguageList[$locale2] = $title2;
                     unset($languageList[$locale2]);
                 } else {
                     $languageList[$locale2] = $title2;
                 }
             }
         } else {
             $localeTitle = SilvercartLanguageHelper::getLanguageDisplayTitle($locale, $currentLocale);
             if (array_key_exists($locale, $usedLocalesWithTitle)) {
                 $usedLanguageList[$locale] = $localeTitle;
                 unset($languageList[$locale]);
             } else {
                 $languageList[$locale] = $localeTitle;
             }
         }
     }
     asort($languageList);
     if (count($usedLanguageList)) {
         asort($usedLanguageList);
         $languageList = array(_t('Form.LANGAVAIL', "Available languages") => $usedLanguageList, _t('Form.LANGAOTHER', "Other languages") => $languageList);
     }
     $localeDropdown->setSource($languageList);
     return $localeDropdown;
 }
 /**
  * augments the hook of the decorated object so that the input in the fields
  * that are multilingual gets written to the related language object
  *
  * @return void 
  * 
  * @author Roland Lehmann <*****@*****.**>
  * @since 06.01.2012
  */
 public function onAfterWrite()
 {
     SilvercartLanguageHelper::writeLanguageObject($this->getLanguage(), $this->owner->toMap());
 }
 /**
  * customizes the backends fields, mainly for ModelAdmin
  *
  * @return FieldList the fields for the backend
  *
  * @author Roland Lehmann <*****@*****.**>, Sebastian Diel <*****@*****.**>
  * @since 13.02.2013
  */
 public function getCMSFields()
 {
     $fields = SilvercartDataObject::getCMSFields($this);
     $paymentMethodsTable = $fields->dataFieldByName('SilvercartPaymentMethods');
     $paymentMethodsTable->setConfig(SilvercartGridFieldConfig_RelationEditor::create());
     $languageFields = SilvercartLanguageHelper::prepareCMSFields($this->getLanguageClassName());
     foreach ($languageFields as $languageField) {
         $fields->insertBefore($languageField, 'ISO2');
     }
     $displayPositionMap = array('0' => _t('SilvercartOrderSearchForm.PLEASECHOOSE'));
     for ($x = 1; $x <= self::getPrioritiveCountryCount(false) + 1; $x++) {
         $displayPositionMap[$x] = $x;
     }
     $displayPositionField = new DropdownField('DisplayPosition', $this->fieldLabel('DisplayPosition'), $displayPositionMap);
     $fields->insertAfter($displayPositionField, 'IsPrioritive');
     return $fields;
 }
 /**
  * input fields for editing
  *
  * @param mixed $params optional
  *
  * @return FieldList
  */
 public function getCMSFields($params = null)
 {
     $fields = parent::getCMSFieldsForModules($params);
     $fields->removeByName('InvoiceInfo');
     $fields->removeByName('TextBankAccountInfo');
     // Add fields to default tab ------------------------------------------
     $channelField = new ReadonlyField('DisplayPaymentChannel', _t('SilvercartPaymentPrepayment.PAYMENT_CHANNEL'), $this->getPaymentChannelName($this->PaymentChannel));
     $fields->addFieldToTab('Root.Basic', $channelField, 'mode');
     // Additional tabs and fields -----------------------------------------
     $tabTextTemplates = new Tab(_t('SilvercartPaymentPrepayment.TEXT_TEMPLATES', 'text templates', null, 'Textvorlagen'));
     $fields->fieldByName('Root')->push($tabTextTemplates);
     // text templates for tab fields
     // Textvorlagen Tab Felder --------------------------------------------
     $languageFields = SilvercartLanguageHelper::prepareCMSFields($this->getLanguageClassName());
     switch ($this->PaymentChannel) {
         case 'invoice':
             $tabTextTemplates->setChildren(new FieldList($languageFields->fieldByName('InvoiceInfo')));
             break;
         case 'prepayment':
         default:
             $tabTextTemplates->setChildren(new FieldList($languageFields->fieldByName('TextBankAccountInfo')));
     }
     $translations = new GridField('SilvercartPaymentPrepaymentLanguages', $this->fieldLabel('SilvercartPaymentPrepaymentLanguages'), $this->SilvercartPaymentPrepaymentLanguages(), SilvercartGridFieldConfig_ExclusiveRelationEditor::create());
     $fields->addFieldToTab('Root.Translations', $translations);
     return $fields;
 }
 /**
  * adjust CMS fields for display in the popup window
  *
  * @param FieldList $fields the FieldList from getCMSFields()
  *
  * @return void 
  * 
  * @author Roland Lehmann <*****@*****.**>
  * @since 06.01.2012
  */
 public function updateCMSFields(FieldList $fields)
 {
     $fields = SilvercartLanguageHelper::prepareCMSFields($this->owner->class);
     $localeDropdown = SilvercartLanguageHelper::prepareLanguageDropdownField($this->owner);
     $fields->push($localeDropdown);
 }
 /**
  * Returns the display language for the given locale
  *
  * @param string $locale    Locale to get language name for
  * @param string $in_locale Native locale
  * 
  * @return string
  */
 public function getDisplayLanguage($locale, $in_locale)
 {
     $displayLanguage = sprintf("%s - %s", SilvercartLanguageHelper::getDisplayLanguage($locale, $in_locale), SilvercartLanguageHelper::getDisplayLanguage($locale, $locale));
     return $displayLanguage;
 }
 /**
  * Clone of DataObject::getCMSFields() with some additional SilverCart
  * related features.
  * <ul>
  *  <li>Restricted fields can be updated by DataExtension (updateRestrictCMSFields).</li>
  *  <li>Translation fields of DataObjects with SilverCart based translation model will be scaffolded.</li>
  * </ul>
  * 
  * @param DataObject $dataObject                     DataObject to get CMS fields for
  * @param string     $neighbourFieldOfLanguageFields Name of the field to insert language fields after or before
  * @param bool       $insertLangugeFieldsAfter       Determines whether to add language fields before or after the given neighbour field
  * @param bool       $tabbed                         Determines whether get tabbed fields or not
  * 
  * @return FieldList
  */
 public static function getCMSFields(DataObject $dataObject, $neighbourFieldOfLanguageFields = null, $insertLangugeFieldsAfter = true, $tabbed = true)
 {
     $params = array('includeRelations' => $dataObject->isInDB(), 'tabbed' => $tabbed, 'ajaxSafe' => true);
     $restrictFields = array();
     $dataObject->extend('updateRestrictCMSFields', $restrictFields);
     if (!empty($restrictFields)) {
         $params['restrictFields'] = $restrictFields;
     }
     $tabbedFields = self::scaffoldFormFields($dataObject, $params);
     if ($dataObject->has_extension($dataObject->class, 'SilvercartDataObjectMultilingualDecorator')) {
         $languageFields = SilvercartLanguageHelper::prepareCMSFields($dataObject->getLanguageClassName());
         foreach ($languageFields as $languageField) {
             if (!is_null($neighbourFieldOfLanguageFields)) {
                 if ($insertLangugeFieldsAfter) {
                     $tabbedFields->insertAfter($languageField, $neighbourFieldOfLanguageFields);
                     /*
                      * Change the name of the field the insert the next field
                      * Otherwise the sort order would be inverted
                      */
                     $neighbourFieldOfLanguageFields = $languageField->getName();
                 } else {
                     $tabbedFields->insertBefore($languageField, $neighbourFieldOfLanguageFields);
                 }
             } else {
                 $tabbedFields->addFieldToTab('Root.Main', $languageField);
             }
         }
     }
     $dataObject->extend('updateCMSFields', $tabbedFields);
     return $tabbedFields;
 }
 /**
  * Returns the CMS fields for the widget context
  *
  * @param array $params Scaffolding params
  * 
  * @return FieldList
  * @deprecated should be removed before release
  */
 public function getCMSFieldsForWidget($params = null)
 {
     $fields = $this->getCMSFieldsForContext(array_merge(array('restrictFields' => array('SortOrder')), (array) $params));
     $languageFields = SilvercartLanguageHelper::prepareCMSFields($this->getLanguageClassName());
     foreach ($languageFields as $languageField) {
         $fields->insertBefore($languageField, 'SortOrder');
     }
     $fields->removeByName('SilvercartProductID');
     $fields->removeByName('SilvercartPaymentMethodID');
     $fields->removeByName('SortOrder');
     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;
 }
 /**
  * Returns all translated locales as a special ArrayList
  *
  * @return ArrayList 
  */
 public function getAllTranslations()
 {
     $currentLocale = Translatable::get_current_locale();
     $translations = $this->getTranslations();
     $translationSource = new ArrayList();
     if ($translations) {
         $translationSource->push(new DataObject(array('Name' => SilvercartLanguageHelper::getLanguageName($currentLocale, $currentLocale), 'NativeName' => SilvercartLanguageHelper::getLanguageName($currentLocale, $currentLocale), 'Code' => $this->getIso2($currentLocale), 'RFC1766' => i18n::convert_rfc1766($currentLocale), 'Link' => $this->Link())));
         foreach ($translations as $translation) {
             $translationSource->push(new DataObject(array('Name' => SilvercartLanguageHelper::getLanguageName($translation->Locale, $currentLocale), 'NativeName' => SilvercartLanguageHelper::getLanguageName($translation->Locale, $translation->Locale), 'Code' => $this->getIso2($translation->Locale), 'RFC1766' => i18n::convert_rfc1766($translation->Locale), 'Link' => $translation->Link())));
         }
     }
     return $translationSource;
 }
 /**
  * customizes the backends fields for file upload on a SilvercartDownloadPage
  * 
  * @param array $params configuration array
  *
  * @return FieldList the fields for the backend
  * 
  * @author Patrick Schneider <*****@*****.**>, Sebastian Diel <*****@*****.**>
  * @since 20.06.2012
  * @deprecated should be removed before release
  */
 public function getCMSFieldsForDownloadPage($params = null)
 {
     $fields = $this->getCMSFieldsForContext($params);
     $languageFields = SilvercartLanguageHelper::prepareCMSFields($this->getLanguageClassName());
     foreach ($languageFields as $languageField) {
         $fields->addFieldToTab('Root.Main', $languageField);
     }
     return $fields;
 }
 /**
  * Builds and returns the CMS fields.
  *
  * @return FieldList the CMS tabs and fields
  *
  * @author Sebastian Diel <*****@*****.**>
  * @since 22.02.2013
  */
 public function getCMSFieldsForSilvercart(FieldList $fields)
 {
     //$tab = $fields->findOrMakeTab('Root.Silvercart', 'SilverCart Shop');
     //$tab->setTitle('SilverCart Shop');
     // Build general toggle group
     $generalConfigurationField = ToggleCompositeField::create('GeneralConfiguration', $this->owner->fieldLabel('GeneralConfiguration'), array(SilvercartLanguageHelper::prepareLanguageDropdownField($this->owner, 'SiteTree', 'DefaultLocale'), new CheckboxField('useDefaultLanguageAsFallback', $this->owner->fieldLabel('useDefaultLanguageAsFallback')), new TextField('DefaultCurrency', $this->owner->fieldLabel('DefaultCurrency')), new DropdownField('DefaultPriceType', $this->owner->fieldLabel('DefaultPriceType'))))->setHeadingLevel(4)->setStartClosed(false);
     // Build email toggle group
     $emailConfigurationField = ToggleCompositeField::create('EmailConfiguration', $this->owner->fieldLabel('EmailConfiguration'), array(new TextField('EmailSender', $this->owner->fieldLabel('EmailSender')), new TextField('GlobalEmailRecipient', $this->owner->fieldLabel('GlobalEmailRecipient')), new TextField('DefaultMailRecipient', $this->owner->fieldLabel('DefaultMailRecipient')), new TextField('DefaultMailOrderNotificationRecipient', $this->owner->fieldLabel('DefaultMailOrderNotificationRecipient')), new TextField('DefaultContactMessageRecipient', $this->owner->fieldLabel('DefaultContactMessageRecipient'))))->setHeadingLevel(4);
     // Build customer toggle group
     $customerConfigurationField = ToggleCompositeField::create('CustomerConfiguration', $this->owner->fieldLabel('CustomerConfiguration'), array(new CheckboxField('enableBusinessCustomers', $this->owner->fieldLabel('enableBusinessCustomers')), new CheckboxField('enablePackstation', $this->owner->fieldLabel('enablePackstation')), new CheckboxField('demandBirthdayDateOnRegistration', $this->owner->fieldLabel('demandBirthdayDateOnRegistration'))))->setHeadingLevel(4);
     // Build product toggle group
     $productConfigurationField = ToggleCompositeField::create('ProductConfiguration', $this->owner->fieldLabel('ProductConfiguration'), array(new CheckboxField('enableStockManagement', $this->owner->fieldLabel('enableStockManagement')), new CheckboxField('isStockManagementOverbookable', $this->owner->fieldLabel('isStockManagementOverbookable')), new TextField('productsPerPage', $this->owner->fieldLabel('productsPerPage')), new TextField('productGroupsPerPage', $this->owner->fieldLabel('productGroupsPerPage')), new TextField('displayedPaginationPages', $this->owner->fieldLabel('displayedPaginationPages')), new UploadField('SilvercartNoImage', $this->owner->fieldLabel('SilvercartNoImage')), new CheckboxField('useStrictSearchRelevance', $this->owner->fieldLabel('useStrictSearchRelevance')), new DropdownField('StandardProductConditionID', $this->owner->fieldLabel('StandardProductConditionID'))))->setHeadingLevel(4);
     // Build checkout toggle group
     $checkoutConfigurationField = ToggleCompositeField::create('CheckoutConfiguration', $this->owner->fieldLabel('CheckoutConfiguration'), array(new CheckboxField('enableSSL', $this->owner->fieldLabel('enableSSL')), new CheckboxField('redirectToCartAfterAddToCart', $this->owner->fieldLabel('redirectToCartAfterAddToCart')), new CheckboxField('redirectToCheckoutWhenInCart', $this->owner->fieldLabel('redirectToCheckoutWhenInCart')), new CheckboxField('useProductDescriptionFieldForCart', $this->owner->fieldLabel('useProductDescriptionFieldForCart')), new DropdownField('productDescriptionFieldForCart', $this->owner->fieldLabel('productDescriptionFieldForCart')), new TextField('addToCartMaxQuantity', $this->owner->fieldLabel('addToCartMaxQuantity')), new CheckboxField('useMinimumOrderValue', $this->owner->fieldLabel('useMinimumOrderValue')), new SilvercartMoneyField('minimumOrderValue', $this->owner->fieldLabel('minimumOrderValue')), new CheckboxField('useFreeOfShippingCostsFrom', $this->owner->fieldLabel('useFreeOfShippingCostsFrom')), new SilvercartMoneyField('freeOfShippingCostsFrom', $this->owner->fieldLabel('freeOfShippingCostsFrom')), new CheckboxField('SkipShippingStepIfUnique', $this->owner->fieldLabel('SkipShippingStepIfUnique')), new CheckboxField('SkipPaymentStepIfUnique', $this->owner->fieldLabel('SkipPaymentStepIfUnique')), new CheckboxField('DisplayWeightsInKilogram', $this->owner->fieldLabel('DisplayWeightsInKilogram')), new CheckboxField('ShowTaxAndDutyHint', $this->owner->fieldLabel('ShowTaxAndDutyHint')), new CheckboxField('InvoiceAddressIsAlwaysShippingAddress', $this->owner->fieldLabel('InvoiceAddressIsAlwaysShippingAddress'))))->setHeadingLevel(4);
     // Build shop data toggle group
     $shopDataConfigurationField = ToggleCompositeField::create('ShopDataConfiguration', $this->owner->fieldLabel('ShopDataConfiguration'), array(new TextField('ShopName', $this->owner->fieldLabel('ShopName')), new TextField('ShopStreet', $this->owner->fieldLabel('ShopStreet')), new TextField('ShopStreetNumber', $this->owner->fieldLabel('ShopStreetNumber')), new TextField('ShopPostcode', $this->owner->fieldLabel('ShopPostcode')), new TextField('ShopCity', $this->owner->fieldLabel('ShopCity')), new DropdownField('ShopCountryID', $this->owner->fieldLabel('ShopCountry'), SilvercartCountry::getPrioritiveDropdownMap())))->setHeadingLevel(4);
     // Build security toggle group
     $securityConfigurationField = ToggleCompositeField::create('SecurityConfiguration', $this->owner->fieldLabel('SecurityConfiguration'), array(new TextareaField('userAgentBlacklist', $this->owner->fieldLabel('userAgentBlacklist'))))->setHeadingLevel(4);
     // Build example data toggle group
     $addExampleDataButton = new InlineFormAction('add_example_data', $this->owner->fieldLabel('addExampleData'));
     $addExampleConfigButton = new InlineFormAction('add_example_config', $this->owner->fieldLabel('addExampleConfig'));
     $exampleDataField = ToggleCompositeField::create('ExampleData', $this->owner->fieldLabel('addExampleData'), array($addExampleDataButton, $addExampleConfigButton))->setHeadingLevel(4);
     $addExampleDataButton->setRightTitle($this->owner->fieldLabel('addExampleDataDesc'));
     $addExampleDataButton->includeDefaultJS(false);
     $addExampleDataButton->setAttribute('data-icon', 'addpage');
     $addExampleConfigButton->setRightTitle($this->owner->fieldLabel('addExampleConfigDesc'));
     $addExampleConfigButton->includeDefaultJS(false);
     $addExampleConfigButton->setAttribute('data-icon', 'addpage');
     // Add groups to Root.Main
     $fields->addFieldToTab('Root.Main', $generalConfigurationField);
     $fields->addFieldToTab('Root.Main', $emailConfigurationField);
     $fields->addFieldToTab('Root.Main', $customerConfigurationField);
     $fields->addFieldToTab('Root.Main', $productConfigurationField);
     $fields->addFieldToTab('Root.Main', $checkoutConfigurationField);
     $fields->addFieldToTab('Root.Main', $shopDataConfigurationField);
     $fields->addFieldToTab('Root.Main', $securityConfigurationField);
     $fields->addFieldToTab('Root.Main', $exampleDataField);
     // Modify field data
     $fields->dataFieldByName('DefaultLocale')->setTitle($this->owner->fieldLabel('DefaultLocale'));
     $fields->dataFieldByName('EmailSender')->setRightTitle($this->owner->fieldLabel('EmailSenderRightTitle'));
     $fields->dataFieldByName('GlobalEmailRecipient')->setRightTitle($this->owner->fieldLabel('GlobalEmailRecipientRightTitle'));
     $fields->dataFieldByName('DefaultMailRecipient')->setRightTitle($this->owner->fieldLabel('DefaultMailRecipientRightTitle'));
     $fields->dataFieldByName('DefaultMailOrderNotificationRecipient')->setRightTitle($this->owner->fieldLabel('DefaultMailOrderNotificationRecipientRightTitle'));
     $fields->dataFieldByName('DefaultContactMessageRecipient')->setRightTitle($this->owner->fieldLabel('DefaultContactMessageRecipientRightTitle'));
     $fields->dataFieldByName('userAgentBlacklist')->setRightTitle($this->owner->fieldLabel('userAgentBlacklistRightTitle'));
     // Add i18n to DefaultPriceType source
     $i18nForDefaultPriceTypeField = array();
     foreach ($this->owner->dbObject('DefaultPriceType')->enumValues() as $value => $label) {
         $i18nForDefaultPriceTypeField[$value] = _t('SilvercartCustomer.' . strtoupper($label), $label);
     }
     $fields->dataFieldByName('DefaultPriceType')->setSource($i18nForDefaultPriceTypeField);
     // Add i18n to productDescriptionFieldForCart source
     $i18nForProductDescriptionField = array();
     foreach ($this->owner->dbObject('productDescriptionFieldForCart')->enumValues() as $productDescriptionField) {
         $i18nForProductDescriptionField[$productDescriptionField] = singleton('SilvercartProduct')->fieldLabel($productDescriptionField);
     }
     $fields->dataFieldByName('productDescriptionFieldForCart')->setSource($i18nForProductDescriptionField);
     $fields->dataFieldByName('StandardProductConditionID')->setEmptyString($this->owner->fieldLabel('StandardProductConditionEmptyString'));
     $this->getCMSFieldsForColorScheme($fields);
     return $fields;
 }