<?php
/**
 * @package DJ-Catalog2
 * @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
 * @license http://www.gnu.org/licenses GNU/GPL
 * @author url: http://dj-extensions.com
 * @author email contact@dj-extensions.com
 */

use Joomla\Registry\Registry;

defined('_JEXEC') or die();

class JFormFieldDjarticle extends Joomla\CMS\Form\Field\ListField {
	
	protected $type = 'Djcarticle';
	
	protected $layout = 'com_djcatalog2.form.field.fancycombo-articles';
	
	/**
	 * Flag to work with nested tag field
	 *
	 * @var    boolean
	 * @since  3.1
	 */
	public $isNested = null;
	
	/**
	 * com_tags parameters
	 *
	 * @var    JRegistry
	 * @since  3.1
	 */
	protected $comParams = null;
	
	/**
	 * Constructor
	 *
	 * @since  3.1
	 */
	public function __construct()
	{
		parent::__construct();
		
		// Load com_tags config
		$this->comParams = JComponentHelper::getParams('com_djcatalog2');
	}
	
	
	protected function getOptions()
	{
		$options = parent::getOptions();
		
		$db = JFactory::getDbo();
		$db->setQuery('SELECT id AS value, title AS text FROM #__content ORDER BY ordering ASC');
		$labels = $db->loadObjectList();
		
		$options = array_merge($options, $labels);
		
		
		return $options;
	}
}
?>