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

Add possibility to save multiple values as JSON #19782

Closed
wants to merge 1 commit into from

Conversation

fastslack
Copy link
Contributor

Summary of Changes

This change add the possibility to save multiple values of FieldList as JSON.

Testing Instructions

Create using JForm a list with multiple value enabled like:

    <field multiple="true" name="options" type="list" label="COM_TEST_FORM_LBL_OPTIONS" description="COM_TEST_FORM_DESC_OPTIONS" hint="COM_TEST_FORM_LBL_OPTIONS">
      <option value="0">COM_TEST_PRODUCTS_OPTIONS_0</option>
      <option value="1">COM_TEST_PRODUCTS_OPTIONS_1</option>
      <option value="2">COM_TEST_PRODUCTS_OPTIONS_2</option>
    </field>

Then add into save() function in models:

    $data['options'] = json_encode($data['options']);

Expected result

You can save multiple values as JSON into database

@laoneo
Copy link
Member

laoneo commented Mar 23, 2022

Sorry that it took so long to respond. While this is a nice addition for Joomla, it should be added to version 4 as it is a new feature. Can you rebase it to the 4.2-dev branch? In the meantime I'm closing the pr, when ready please reopen so we can properly test it. Thanks for your contribution, making Joomla better.

@laoneo laoneo closed this Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants