@github Joomla Component Builder @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html Builds Complex Joomla Components /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); /** * Joomlacomponents Form Field class for the Componentbuilder component */ class JFormFieldJoomlacomponents extends JFormFieldList { /** * The joomlacomponents field type. * * @var string */ public $type = 'joomlacomponents'; /** * Method to get a list of options for a list input. * * @return array An array of JHtml options. */ public function getOptions() { $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select($db->quoteName(array('a.id','a.system_name'),array('id','joomla_component_system_name'))); $query->from($db->quoteName('#__componentbuilder_joomla_component', 'a')); $query->order('a.system_name 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', $item->id, $item->joomla_component_system_name); } } return $options; } }