getQuery(true) ->select('DISTINCT a.name AS text, a.element AS value') ->from('#__extensions as a') ->where('a.enabled >= 1') ->where('a.type =' . $db->quote('component')) ->join('INNER', '#__categories as b ON a.element=b.extension'); $items = $db->setQuery($query)->loadObjectList(); if (count($items)) { $lang = JFactory::getLanguage(); foreach ($items as &$item) { // Load language $extension = $item->value; $source = JPATH_ADMINISTRATOR . '/components/' . $extension; $lang->load("$extension.sys", JPATH_ADMINISTRATOR, null, false, true) || $lang->load("$extension.sys", $source, null, false, true); // Translate component name $item->text = JText::_($item->text); } // Sort by component name $items = ArrayHelper::sortObjects($items, 'text', 1, true, true); } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $items); return $options; } }