magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.49k stars 9.29k forks source link

WYSIWYG add_images config option does't work properly #30495

Closed 0m3r closed 3 years ago

0m3r commented 3 years ago

Reproduced at 2.3.5 the same code in 2.4

if I try to hide "Insert Image(s)" https://devdocs.magento.com/guides/v2.4/ui_comp_guide/components/ui-wysiwyg.html

<field name="wysiwyg_example" sortOrder="50" formElement="wysiwyg">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="wysiwygConfigData" xsi:type="array">
                        <item name="add_images" xsi:type="boolean">false</item>

it don't hide because add_images option set at line https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Cms/Model/Wysiwyg/Config.php#L202 will be always overwritten at https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Cms/Model/Wysiwyg/Config.php#L207

        if (is_array($data)) {
            $config->addData($data);
        }

        if ($this->_authorization->isAllowed('Magento_Cms::media_gallery')) {
            $this->configProvider->processGalleryConfig($config);

Possible solution https://github.com/magento/magento2/blob/bc8e51d18cbd327dc09b9e3813b7d1032dd9d959/app/code/Magento/Cms/Model/Wysiwyg/Gallery/DefaultConfigProvider.php#L86

$addImages = (bool) $config->hasData('add_images') ? $config->getData('add_images') : true;
return $config->addData(
            [
                'add_images' => $addImages,
m2-assistant[bot] commented 3 years ago

Hi @0m3r. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!

sumalicarter commented 1 year ago

This is still an issue: found on enterprise M2 version 2.4.4