Skip to content

WYSIWYG is empty in dynamic rows #38893

Open
@thomas-kl1

Description

@thomas-kl1

Preconditions and environment

  • Magento 2.4.7 (but actually any version)

Add a design_config_form.xml adminhtml ui component with the following:

<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <fieldset name="other_settings">
        <fieldset name="header">
            <dynamicRows name="top_information">
                <settings>
                    <label translate="true">Top Information</label>
                    <componentType>dynamicRows</componentType>
                </settings>
                <container name="record" component="Magento_Ui/js/dynamic-rows/record">
                    <argument name="data" xsi:type="array">
                        <item name="config" xsi:type="array">
                            <item name="isTemplate" xsi:type="boolean">true</item>
                            <item name="is_collection" xsi:type="boolean">true</item>
                            <item name="componentType" xsi:type="string">container</item>
                        </item>
                    </argument>
                    <field name="caption" formElement="wysiwyg">
                        <argument name="data" xsi:type="array">
                            <item name="config" xsi:type="array">
                                <item name="wysiwygConfigData" xsi:type="array">
                                    <item name="height" xsi:type="string">100px</item>
                                    <item name="add_variables" xsi:type="boolean">true</item>
                                    <item name="add_widgets" xsi:type="boolean">false</item>
                                    <item name="add_images" xsi:type="boolean">false</item>
                                    <item name="add_directives" xsi:type="boolean">false</item>
                                    <item name="pagebuilder_button" xsi:type="boolean">false</item>
                                    <item name="is_pagebuilder_enabled" xsi:type="boolean">false</item>
                                    <item name="toggle_button" xsi:type="boolean">true</item>
                                    <item name="dynamic_id" xsi:type="boolean">true</item>
                                </item>
                            </item>
                        </argument>
                        <settings>
                            <label>Caption</label>
                        </settings>
                        <formElements>
                            <wysiwyg>
                                <settings>
                                    <cols>20</cols>
                                    <rows>8</rows>
                                    <wysiwyg>true</wysiwyg>
                                </settings>
                            </wysiwyg>
                        </formElements>
                    </field>
                    <actionDelete template="Magento_Backend/dynamic-rows/cells/action-delete">
                        <settings>
                            <label>Actions</label>
                            <componentType>actionDelete</componentType>
                        </settings>
                    </actionDelete>
                </container>
            </dynamicRows>
        </fieldset>
    </fieldset>
</form>

Now add a config.xml file in the etc folder of your module (workaround from #38733):

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
    <default>
        <design>
            <header>
                <top_information>
                    <row1>
                        <caption><![CDATA[<p>Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...<p>]]></caption>
                    </row1>
                    <row2>
                        <caption><![CDATA[<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.<p>]]></caption>
                    </row2>
                    <row3>
                        <caption><![CDATA[<p>Cras bibendum ullamcorper hendrerit. Pellentesque ultricies molestie leo a consequat.</p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.<p>]]></caption>
                    </row3>
                </sev_top_information>
            </header>
        </design>
    </default>
</config>

Now you need the di.xml:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Theme\Model\Design\Config\MetadataProvider">
        <arguments>
            <argument name="metadata" xsi:type="array">
                <item name="top_information" xsi:type="array">
                    <item name="path" xsi:type="string">design/header/top_information</item>
                    <item name="fieldset" xsi:type="string">other_settings/header</item>
                    <item name="backend_model" xsi:type="string">Magento\Config\Model\Config\Backend\Serialized\ArraySerialized</item>
                </item>
            </argument>
        </arguments>
    </type>
</config>

Steps to reproduce

  • Go to Design > Config
  • Select scope default
  • Check the top information field
  • Fields are empty
  • If you delete the 2 first rows, the fields are now correctly initialized and filled, but an empty row remains, remove this empty row
  • Now keep the 3 valid rows, edit the content of these 3 rows
  • Save the config
  • Now you can see that the first row is correctly filled, the 2 other are empty.
  • Add a new row, and remove it, the 2 other fields are now correctly filled

Expected result

You can see 3 rows with filled wysiwyg from the default value of config.xml
Wysiwyg in rows are always filled and correctly initialized.

Actual result

Rows should be initialized and filled correctly.

Additional information

No response

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: UI FrameworkComponent: UiIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P1Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing.Progress: ready for devReported on 2.4.7Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions