cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2 UI component import from two sources

Magento 2 UI component import from two sources

Hello. 

I need the product field "disabled" attribute to be dependent from two other checkbox fields. For now I have it dependent from one field like this (DataModfier):

protected function customizeFieldSub(array $meta)
{    $dependentPath = $this->arrayManager->findPath('show_email_for_instant_price', $meta, null, 'children');

    if ($dependentPath) {        $meta = $this->arrayManager->merge(            $dependentPath . static::META_CONFIG_PATH,            $meta,
            [
                'dataScope' => 'dependent_field',
                'validation' => [
                    'required-entry' => true,
                    'validate-zero-or-greater' => true
                ],
                'formElement' => 'input',
                'additionalClasses' => 'admin__field-small',
                'imports' => [
                    'disabled' => 
                        '!ns = ${ $.ns }, index = field1:checked'
                ]
            ]
        );
    }
    return $meta;
}

I need something like this:

               'imports' => [
                    'disabled' =>
                        '(!ns = ${ $.ns }, index = field1:checked) && (!ns = ${ $.ns }, index = field2:checked)'
                ]

But it doesn't work this way. And also it doesn't allow to use functions there. How can I achieve what I want? I need the field to be disabled until you enable two checkboxes