0

I am trying to add some fields to CMS pages so I can add some stuff to the sidebar. I followed some tutorials I found online but seem to be missing something.

The current setup correctly shows the fields but when I change the default text in the magento backend the changes to the text are not saved.

<?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="sidebar_content">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="label" xsi:type="string" translate="true">Sidebar Content</item>
                <item name="collapsible" xsi:type="boolean">true</item>
                <item name="sortOrder" xsi:type="number">30</item>
            </item>
        </argument>

        <field name="sidebar_element">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="dataType" xsi:type="string">string</item>
                    <item name="source" xsi:type="string">category</item>
                    <item name="class" xsi:type="string">\Magento\Ui\Component\Form\Element\Wysiwyg</item>
                    <item name="formElement" xsi:type="string">wysiwyg</item>
                    <item name="label" xsi:type="string" translate="true">Zijbalk blok 1</item>
                    <item name="template" xsi:type="string">ui/form/field</item>
                    <item name="wysiwyg" xsi:type="boolean">true</item>
                    <item name="dataScope" xsi:type="string">detail</item>
                    <item name="sortOrder" xsi:type="number">1</item>
                    <item name="rows" xsi:type="number">8</item>
                    <item name="default" xsi:type="string">this is the default text</item>
                </item>
            </argument>
        </field>

        <field name="sidebar_element_2">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="dataType" xsi:type="string">string</item>
                    <item name="source" xsi:type="string">category</item>
                    <item name="class" xsi:type="string">\Magento\Ui\Component\Form\Element\Wysiwyg</item>
                    <item name="formElement" xsi:type="string">wysiwyg</item>
                    <item name="label" xsi:type="string" translate="true">Zijbalk blok 2</item>
                    <item name="template" xsi:type="string">ui/form/field</item>
                    <item name="wysiwyg" xsi:type="boolean">true</item>
                    <item name="dataScope" xsi:type="string">detail</item>
                    <item name="sortOrder" xsi:type="number">2</item>
                    <item name="rows" xsi:type="number">8</item>
                    <item name="default" xsi:type="string">this is the default text</item>
                </item>
            </argument>
        </field>

        <field name="sidebar_element_3">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="dataType" xsi:type="string">string</item>
                    <item name="source" xsi:type="string">category</item>
                    <item name="class" xsi:type="string">\Magento\Ui\Component\Form\Element\Wysiwyg</item>
                    <item name="formElement" xsi:type="string">wysiwyg</item>
                    <item name="label" xsi:type="string" translate="true">Zijbalk blok 3</item>
                    <item name="template" xsi:type="string">ui/form/field</item>
                    <item name="wysiwyg" xsi:type="boolean">true</item>
                    <item name="dataScope" xsi:type="string">detail</item>
                    <item name="sortOrder" xsi:type="number">3</item>
                    <item name="rows" xsi:type="number">8</item>
                    <item name="default" xsi:type="string">this is the default text</item>
                </item>
            </argument>
        </field>
    </fieldset>
</form>

Is there something else I need to add, like do I have to update the save functionality, because I didn't read about that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.