0

Here is my file path

/Vendor/Module/Ui/DataProvider/Product/Form/Modifier/Custom.php

In that I already added text field like

/**
 * Example text field config
 *
 * @param $sortOrder
 * @return array
 */
protected function getVideoUrl($sortOrder)
{
    return [
        'arguments' => [
            'data' => [
                'config' => [
                    'label' => __('Video Url'),
                    'formElement' => Field::NAME,
                    'componentType' => Input::NAME,
                    'dataScope' => static::FIELD_VIDEO_URL,
                    'dataType' => Number::NAME,
                    'sortOrder' => $sortOrder,
                ],
            ],
        ],
    ];
}

Now I need to add file upload field in that How can I set file upload filed in that

enter image description here

1
1

Add This and First Click on Add New Product Form. After Save Your Image Data Modify modifyData() function for set image Array.

public function getFileUploaderField()
{
    return [
        'arguments' => [
            'data' => [
                'config' => [
                    'label' => __('Upload Image'),
                    'componentType' => Field::NAME,
                    'previewTmpl' => 'Magento_Catalog/image-preview',
                    'elementTmpl' => 'ui/form/element/uploader/uploader',
                    'formElement' => "fileUploader",
                    'dataScope' => "image_upload",
                    'dataType' => Text::NAME,
                    'sortOrder' => 10,
                    'visible' => 1,
                    'uploaderConfig' => ['url' => 'your_router/contoller/upload"'],
                ],
            ],
        ],
    ];
}

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.