forked from pollen8/fabrik
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
66 additions
and
0 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
administrator/components/com_fabrik/models/fields/fabrikfolderlist.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |