1

I have a list of elements printed with a field type='checkboxes' but when I try to save only one of the results saved.

As a solution to this problem, we tried to print each element with a checkbox and so Magento saves it in the database as a single row.

Right now we have an array with the data and what we need is to loop through them as a field in the system.xml

The system.xml is like that:

 <field id="cmspage" translate="label comment" type="checkboxes" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
        <label>Lista pagine</label>
        <source_model>[vendor]\PersonalMenu\Model\Adminhtml\System\Config\Source\Cms\Cms</source_model>
        <backend_model>Magento\Config\Model\Config\Backend\Serialized\ArraySerialized</backend_model>
 </field>

The source_model give in the output the array

Is the backend_model the file where we can set the loop?

Or are there some other ways to customize a module settings page with all the elements dynamically showed?

P.S. sorry for my English

0

Is the config type "checkboxes" a custom type for system.xml you implemented ? because i don't think there is a type in vanilla Magento2 which is called like this.

You may want to utilize a frontend_model to render the checkboxes in your store configuration. Here is a guide how to set up a frontend_model for a store configuration field: https://magently.com/blog/magento-2-backend-configuration-frontend-model-part-33/

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.