Skip to content

Commit

Permalink
List folder in the template & local as well
Browse files Browse the repository at this point in the history
  • Loading branch information
khanhlh committed Oct 17, 2014
1 parent 17b642e commit 0549890
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions source/plg_system_t3/includes/depend/t3folderlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 0549890

Please sign in to comment.