/** * Method to get the field options. * * @return array The field option objects. */ protected function getOptions() { if (empty($this->cache)) { $app = RFactory::getApplication(); $options = array(); // Load specifc data channels? $types = $this->element['types'] ? explode(',', $this->element['types']) : array(); // Try to load the active dataChannels JPluginHelper::importPlugin('rschannel'); if ($dataChannels = $app->triggerEvent('onGetChannelTypes', array($types))) { foreach ($dataChannels as $channel) { $options[] = (object) array('value' => $channel->getType(), 'text' => $channel->getTitle()); } $options = array_merge(parent::getOptions(), $options); } $this->cache = $options; } return $this->cache; }
/** * Method to get the field options. * * @return array The field option objects. */ protected function getOptions() { if (empty($this->cache)) { $app = RFactory::getApplication(); $options = array(); $db = JFactory::getDbo(); $query = $db->getQuery(true)->select('id as value, name as text')->from('#__redsource_channel'); // Load specifc data channels? $states = $this->element['states'] ? $this->element['states'] : 1; if ($states !== null) { $states = explode(',', $states); JArrayHelper::toInteger($states); $query->where('state IN(' . implode(',', $states) . ')'); } $db->setQuery($query); if ($options = $db->loadObjectList()) { $options = array_merge(parent::getOptions(), $options); } $this->cache = $options; } return $this->cache; }