/** * Constructor. * * @param string $name Name of the attribute * @param int $flags Flags for the attribute * @param array $options CKEditor configuration options */ public function __construct($name, $flags = 0, $options = []) { $this->ckOptions['language'] = Language::getLanguage(); $this->ckOptions['wsc_lang'] = $this->ckOptions['scayt_sLang'] = Tools::atktext('locale'); $this->ckOptions = array_merge($this->ckOptions, Config::getGlobal('ck_options'), $options); parent::__construct($name, $flags); }
/** * Returns a piece of html code that can be used in a form to edit this * attribute's value. * * @param array $record The record that holds the value for this attribute. * @param string $fieldprefix The fieldprefix to put in front of the name * of any html form element for this attribute. * @param string $mode The mode we're in ('add' or 'edit') * * @return string A piece of htmlcode for editing this attribute */ public function edit($record, $fieldprefix, $mode) { if ($this->m_defaulttocurrent && !$record[$this->fieldName()]) { $record[$this->fieldName()] = strtoupper(Language::getLanguage()); } return parent::edit($record, $fieldprefix, $mode); }
/** * Get Country option, when current language doesn't exists * it will return the english language. * * @param string $iso_code 2 Letter iso code of the country * * @return string Country name */ public function getCountryOption($iso_code) { $lng = Language::getLanguage(); if (!array_key_exists($iso_code, $this->m_country)) { Tools::atkdebug('UNKNOWN ISO CODE: ' . $iso_code); } if (array_key_exists($lng, $this->m_country[$iso_code])) { return $this->m_country[$iso_code][$lng]; } else { return $this->m_country[$iso_code]['en']; } }