From 3002e093dee0197d9d6a990050bdd2d285dfb845 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Fri, 13 Apr 2018 22:11:35 +0200 Subject: [PATCH] Added custom getOptions back after the fix of the field area --- README.md | 2 +- admin/README.txt | 2 +- admin/models/fields/adminviewfolderlist.php | 16 +++++++++++++++- admin/models/fields/siteviewfolderlist.php | 16 +++++++++++++++- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0abdc2f3f..f3bb61a74 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,7 @@ Component Builder is mapped as a component in itself on my local development env + *Version*: 2.7.3 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html -+ *Line count*: **182266** ++ *Line count*: **182294** + *Field count*: **1012** + *File count*: **1199** + *Folder count*: **193** diff --git a/admin/README.txt b/admin/README.txt index 0abdc2f3f..f3bb61a74 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -130,7 +130,7 @@ Component Builder is mapped as a component in itself on my local development env + *Version*: 2.7.3 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html -+ *Line count*: **182266** ++ *Line count*: **182294** + *Field count*: **1012** + *File count*: **1199** + *Folder count*: **193** diff --git a/admin/models/fields/adminviewfolderlist.php b/admin/models/fields/adminviewfolderlist.php index d40d8f2d2..2bf772574 100644 --- a/admin/models/fields/adminviewfolderlist.php +++ b/admin/models/fields/adminviewfolderlist.php @@ -49,6 +49,20 @@ class JFormFieldAdminviewfolderlist extends JFormFieldList */ public function getOptions() { - return null; + // get custom folder files + $localfolder = JPATH_COMPONENT_ADMINISTRATOR.'/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; } } diff --git a/admin/models/fields/siteviewfolderlist.php b/admin/models/fields/siteviewfolderlist.php index a99f8de0c..782c9e00f 100644 --- a/admin/models/fields/siteviewfolderlist.php +++ b/admin/models/fields/siteviewfolderlist.php @@ -49,6 +49,20 @@ class JFormFieldSiteviewfolderlist extends JFormFieldList */ public function getOptions() { - return null; + // 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; } }