From 0549890d2044e81711c820777c0780252d60c864 Mon Sep 17 00:00:00 2001 From: Khanh Le Date: Fri, 17 Oct 2014 16:09:44 +0700 Subject: [PATCH] List folder in the template & local as well --- .../includes/depend/t3folderlist.php | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/source/plg_system_t3/includes/depend/t3folderlist.php b/source/plg_system_t3/includes/depend/t3folderlist.php index 659e196bf1..73cea6e5e2 100644 --- a/source/plg_system_t3/includes/depend/t3folderlist.php +++ b/source/plg_system_t3/includes/depend/t3folderlist.php @@ -52,17 +52,20 @@ protected function getOptions() $path = (string) $this->element['directory']; if (!is_dir($path)) { - $this->directory = $this->element['directory'] = T3_TEMPLATE_PATH . DIRECTORY_SEPARATOR . $path; - } - - if(!is_dir($this->element['directory'])){ - $hideDefault = (string) $this->element['hide_default']; - - if (!$hideDefault) - { - $options[] = JHtml::_('select.option', '', JText::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname))); + // process path in template + $options = array(); + $vals = array(); + // get all path in template + $paths = T3Path::getAllPath ($path); + foreach ($paths as $path) { + $this->directory = $this->element['directory'] = $path; + $tmps = parent::getOptions(); + foreach ($tmps as $tmp) { + if (in_array($tmp->value, $vals)) continue; + $vals[] = $tmp->value; + $options[] = $tmp; + } } - return $options; }