/** * put together a dropdown for the country field * * @param String $name - name of the field * @return DropdownField **/ protected function getCountryField($name) { $countriesForDropdown = EcommerceCountry::list_of_allowed_entries_for_dropdown(); $title = _t("OrderAddress." . strtoupper($name), "Country"); $countryField = new DropdownField($name, $title, $countriesForDropdown, EcommerceCountry::get_country()); $countryField->setRightTitle(_t("OrderAddress." . strtoupper($name) . "_RIGHT", "")); if (count($countriesForDropdown) < 2) { $countryField = $countryField->performReadonlyTransformation(); if (count($countriesForDropdown) < 1) { $countryField = new HiddenField($name, '', "not available"); } } $prefix = EcommerceConfig::get("OrderAddress", "field_class_and_id_prefix"); $countryField->addExtraClass($prefix . 'ajaxCountryField'); //important, otherwise loadData will override the default value.... $this->{$name} = EcommerceCountry::get_country(); return $countryField; }
/** * put together a dropdown for the country field * @param String $name - name of the field * @return DropdownField **/ protected function getCountryField($name) { $countriesForDropdown = EcommerceCountry::list_of_allowed_entries_for_dropdown(); $countryField = new DropdownField($name, EcommerceCountry::i18n_singular_name(), $countriesForDropdown, EcommerceCountry::get_country()); if (count($countriesForDropdown) < 2) { $countryField = $countryField->performReadonlyTransformation(); if (count($countriesForDropdown) < 1) { $countryField = new HiddenField($name, '', "not available"); } } $prefix = EcommerceConfig::get("OrderAddress", "field_class_and_id_prefix"); $countryField->addExtraClass($prefix . 'ajaxCountryField'); return $countryField; }