2017-10-26 16:43:51 +00:00
|
|
|
<?php
|
2018-05-18 06:28:27 +00:00
|
|
|
/**
|
|
|
|
* @package Joomla.Component.Builder
|
|
|
|
*
|
|
|
|
* @created 30th April, 2015
|
|
|
|
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
|
|
|
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
2020-12-25 21:16:34 +00:00
|
|
|
* @copyright Copyright (C) 2015 - 2021 Vast Development Method. All rights reserved.
|
2018-05-18 06:28:27 +00:00
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
|
|
|
*/
|
2017-10-26 16:43:51 +00:00
|
|
|
|
|
|
|
// 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
|
|
|
|
*/
|
2018-03-30 07:58:24 +00:00
|
|
|
public $type = 'joomlacomponents';
|
2017-10-26 16:43:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to get a list of options for a list input.
|
|
|
|
*
|
2018-09-25 20:02:48 +00:00
|
|
|
* @return array An array of JHtml options.
|
2017-10-26 16:43:51 +00:00
|
|
|
*/
|
2018-09-25 20:02:48 +00:00
|
|
|
protected function getOptions()
|
2017-10-26 16:43:51 +00:00
|
|
|
{
|
2018-05-11 04:08:14 +00:00
|
|
|
$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;
|
2017-10-26 16:43:51 +00:00
|
|
|
}
|
|
|
|
}
|