/** * Method to get the field suggestions. * * @return array The field option objects. * * @since 11.1 */ protected function getSuggestions() { $options = array(); $db = JFactory::getDbo(); $query = $db->getQuery(true)->select('city AS value, city AS `text`, country AS class')->from('#__sibdiet_profiles')->group('city')->order('class, value'); $db->setQuery($query); try { $options = $db->loadObjectList(); } catch (RuntimeException $e) { JError::raiseWarning(500, $e->getMessage()); } return array_merge(parent::getSuggestions(), $options); }
/** * Method to get the field suggestions. * * @return array The field option objects. * * @since 11.1 */ protected function getSuggestions() { $options = array(); $db = JFactory::getDbo(); $query = $db->getQuery(true)->select('name AS value, name AS text')->from('#__testyourself_questions AS a')->order('a.name')->group('name'); // Get the options. $db->setQuery($query); try { $options = $db->loadObjectList(); } catch (RuntimeException $e) { JError::raiseWarning(500, $e->getMessage()); } return array_merge(parent::getSuggestions(), $options); }