Skip to content

Commit

Permalink
Create fabrikfolderlist.php
Browse files Browse the repository at this point in the history
  • Loading branch information
trob committed Jul 24, 2016
1 parent d648c12 commit 8f0e1ed
Showing 1 changed file with 66 additions and 0 deletions.
@@ -0,0 +1,66 @@
<?php
/**
* Get a list of templates - either in components/com_fabrik/views/{view}/tmpl or {view}/tmpl25
*
* @package Joomla
* @subpackage Form
* @copyright Copyright (C) 2005-2015 fabrikar.com - All rights reserved.
* @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
*/

// No direct access
defined('_JEXEC') or die('Restricted access');

jimport('joomla.html.html');
jimport('joomla.form.formfield');
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('folderlist');

/**
* Get a list of templates - either in components/com_fabrik/views/{view}/tmpl or {view}/tmpl25
*
* @package Joomla
* @subpackage Form
* @since 3.1b
*/
class JFormFieldFabrikFolderlist extends JFormFieldFolderList
{
/**
* The form field type.
*
* @var string
* @since 1.6
*/
public $type = 'FabrikFolderlist';

/**
* Method to get the field options.
*
* @return array The field option objects.
*/
protected function getOptions()
{
$dir = JPATH_ROOT . $this->element['directory'];

$dir = str_replace('\\', '/', $dir);
$dir = str_replace('//', '/', $dir);


$this->element['directory'] = $this->directory = $dir;


$opts = parent::getOptions();

foreach ($opts as &$opt)
{
$opt->value = str_replace('\\', '/', $opt->value);
$opt->value = str_replace('//', '/', $opt->value);
$opt->value = str_replace($dir, '', $opt->value);
$opt->text = str_replace('\\', '/', $opt->text);
$opt->text = str_replace('//', '/', $opt->text);
$opt->text = str_replace($dir, '', $opt->text);
}

return $opts;
}
}

0 comments on commit 8f0e1ed

Please sign in to comment.