1

How can i change Yes to Active and No to Deactive?

status

i've tried it with toOptionArray():

class ActiveDeactive implements \Magento\Framework\Option\ArrayInterface
{
    public function toOptionArray()
    {
        return [
            'value' => 'Active',
            'value_another' => 'Deactive'
        ];
    }
}

and with xml:

<field name="status">
    <argument name="data" xsi:type="array">
       <item name="config" xsi:type="array">
            <item name="dataType" xsi:type="string">boolean</item>
                 <item name="label" xsi:type="string" translate="true">Status</item>
                 <item name="formElement" xsi:type="string">checkbox</item>
                 <item name="source" xsi:type="string">pricelist</item>
                 <item name="dataScope" xsi:type="string">status</item>
                 <item name="prefer" xsi:type="string">toggle</item>
                 <item name="valueMap" xsi:type="array">
                     <item name="true" xsi:type="string">Active</item>
                     <item name="false" xsi:type="string">Deactive</item>
                 </item>
            <item name="default" xsi:type="string">Active</item>
        </item>
    </argument>
</field>

and also with the option xml attribute:

<argument name="data" xsi:type="array">
        <item name="options" xsi:type="object">\Vendor\Module\Model\Adminhtml\System\Config\Source\ActiveDeactive</item>
        ...

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.