2016-10-23 22:48:26 +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
|
|
|
|
*/
|
2016-10-23 22:48:26 +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');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Siteviewfolderlist Form Field class for the Componentbuilder component
|
|
|
|
*/
|
|
|
|
class JFormFieldSiteviewfolderlist extends JFormFieldList
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The siteviewfolderlist field type.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2018-03-30 07:58:24 +00:00
|
|
|
public $type = 'siteviewfolderlist';
|
2016-10-23 22:48:26 +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.
|
2016-10-23 22:48:26 +00:00
|
|
|
*/
|
2018-09-25 20:02:48 +00:00
|
|
|
protected function getOptions()
|
2016-10-23 22:48:26 +00:00
|
|
|
{
|
2018-04-13 20:11:35 +00:00
|
|
|
// get custom folder files
|
|
|
|
$localfolder = JPATH_COMPONENT_SITE.'/views';
|
|
|
|
// set the default
|
|
|
|
$options = array();
|
|
|
|
// import all needed classes
|
|
|
|
jimport('joomla.filesystem.folder');
|
|
|
|
// now check if there are files in the folder
|
|
|
|
if (JFolder::exists($localfolder) && $folders = JFolder::folders($localfolder))
|
|
|
|
{
|
|
|
|
foreach ($folders as $folder)
|
|
|
|
{
|
|
|
|
$options[] = JHtml::_('select.option', $folder, ComponentbuilderHelper::safeString($folder, 'W'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $options;
|
2016-10-23 22:48:26 +00:00
|
|
|
}
|
|
|
|
}
|