1

I have a ui-component

        <field name="interest" formElement="multiselect">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="source" xsi:type="string">customer</item>
                </item>
                <item name="options" xsi:type="object">
                    \Model\InterestOptions
                </item>
            </argument>
            <settings>
                <imports>
                    <link name="customerId">${ $.provider }:data.customer.entity_id</link>
                </imports>
                <label translate="true">Interest</label>
            </settings>

        </field>

And the data source come from InterestOptions.php

class InterestOptions implements OptionSourceInterface
{
    public function toOptionArray()
    {

        return [
            'option1' => [
                'label' => 'Option 1',
                'value' => 'option1'
            ],
            'option2' => [
                'label' => 'Option 2',
                'value' => 'option2'
            ]
        ];
    }
}

How can I auto checked some value by my own logic in my source php?

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.