Fixed gh-264 another glitch due to the update of the field area, that caused the language tag selection to break

This commit is contained in:
2018-04-14 02:01:34 +02:00
parent 82c9b6edef
commit 81e5038bb2
7 changed files with 33 additions and 15 deletions

View File

@ -49,6 +49,23 @@ class JFormFieldLang extends JFormFieldList
*/
public function getOptions()
{
return null;
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.langtag','a.name'),array('langtag','language_name')));
$query->from($db->quoteName('#__componentbuilder_language', 'a'));
$query->where($db->quoteName('a.published') . ' >= 1');
$query->order('a.langtag ASC');
$db->setQuery((string)$query);
$items = $db->loadObjectList();
$options = array();
if ($items)
{
$options[] = JHtml::_('select.option', '', 'Select an option');
foreach($items as $item)
{
$options[] = JHtml::_('select.option', trim($item->langtag), $item->language_name . ' (' .$item->langtag.')');
}
}
return $options;
}
}

View File

@ -141,6 +141,7 @@
label="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_LANGUAGE_LABEL"
class="list_class"
multiple="false"
default="0"
required="false"
button="false"
/>