User tests: Successful: Unsuccessful:
Currently, the exclude attribute for the folderlist does not work. This is because the list of folders that are tested against the regular expression in exclude contains the full folder path and not the folder name only. So, instead of removing the root part after you test for the exclude, remove the root path before.
Pull Request for Issue # .
Move comment and code at lines 224-225 and place them before line 215. This will remove the root part and the leading /, so that you only test the folder name itself against the exclude regular expression.
Since there are no built-in extensions that use folder list, you can add the following field to any module's xml file to test it:
<field name="test_field" type="folderlist" default="images" label="TEST_LABEL" directory="" description="TEST_DESC" hide_none="true" hide_default="true" exclude="^[Aa]dministrator$|^[Cc]ache$|^[Cc]omponents$|^[Cc]li$|^[Ii]ncludes$|^[Ll]anguage$|^[Ll]ibraries$|^[Ll]ogs$|^[Mm]odules$|^[Pp]lugins$|^[Tt]emplates$|^[Xx]mlrpc$" />
The drop down list should exclude the following folders: administrator, cache, components, includes, languages, cli, libraries, logs, modules, plugins, templates, xmlrpc. It should only list: bin, images, layouts, media, tmp, and any other admin created folders in the Joomla root.
Unfortunately, it lists all the folders in the Joomla root.
Cut lines 224-225 and paste them at line 215. So lines 213-228 of the code will look like:
foreach ($folders as $folder)
{
// Remove the root part and the leading /
$folder = trim(str_replace($path, '', $folder), '/');
// Check to see if the file is in the exclude mask.
if ($this->exclude)
{
if (preg_match(chr(1) . $this->exclude . chr(1), $folder))
{
continue;
}
}
$options[] = JHtml::_('select.option', $folder, $folder);
}
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
rtc
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-05-20 09:14:10 |
Closed_By | ⇒ | infograf768 | |
Labels |
Added:
?
|
Thanks.
I have tested this item✅ successfully on 8ed4f60
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/22032.