Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImagelistField uses com_media extension #39942

Closed
wants to merge 10 commits into from
20 changes: 19 additions & 1 deletion libraries/src/Form/Field/ImagelistField.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

namespace Joomla\CMS\Form\Field;

use Joomla\CMS\Component\ComponentHelper;

// phpcs:disable PSR1.Files.SideEffects
\defined('JPATH_PLATFORM') or die;
// phpcs:enable PSR1.Files.SideEffects
Expand Down Expand Up @@ -39,7 +41,23 @@ class ImagelistField extends FilelistField
protected function getOptions()
{
// Define the image file type filter.
$this->fileFilter = '\.png$|\.gif$|\.jpg$|\.bmp$|\.ico$|\.jpeg$|\.psd$|\.eps$';
$this->fileFilter =
'\.png$|\.gif$|\.jpg$|\.bmp$|\.ico$|\.jpeg$|\.psd$|\.eps$' .
join(
'|',
array_map(
function ($extension) {
return '\.' . $extension . '$';
},
explode(
',',
ComponentHelper::getParams('com_media')->get(
'image_extensions',
'bmp,gif,jpg,jpeg,png,webp,avif'
)
)
)
);

// Get the field options.
return parent::getOptions();
Expand Down