public function prepareTableValue($data, XMLElement $link = null, $entry_id = null) { $selected = array_map('trim', explode(',', $data['value'])); $options = Extension_Languages::findOptions(); $value = array(); foreach ($selected as $code) { foreach ($options as $details) { if ($details[0] == $code) { $value[] = $details[2]; break; } } } $value = implode(', ', $value); return parent::prepareTableValue(array('value' => $value), $link, $entry_id); }
/** * Convenience method; builds main language select * * @param XMLElement &$wrapper * @param array $context */ private function _appendMainLang(&$wrapper, $context) { $label = Widget::Label(__('Main language'), null, 'column', 'frontend_localisation' . '_main_lang'); $options = Extension_Languages::findOptions(FLang::getMainLang(), FLang::getLangs()); $label->appendChild(Widget::Select('settings[' . 'frontend_localisation' . '][main_lang]', $options)); $label->appendChild(new XMLElement('p', __('Select the main language of the site.'), array('class' => 'help'))); if (isset($context['errors']['frontend_localisation']['main_lang'])) { $wrapper->appendChild(Widget::Error($label, $context['errors']['frontend_localisation']['main_lang'])); } else { $wrapper->appendChild($label); } }