1

Preview image is getting properly on Ui Edit form with other fields data when it was accessed by Administrator Role user. But when its comes to Other Role users which has limited access (i.e. Access of specific Websites/stores), The preview image is not showing on edit form, other form field data is getting properly. what fixes is expected here towards fixing this scenario?

added the content of professional_form.xml

<fieldset name="professional">
    <settings>
        <label translate="true">Business Logo</label>
    </settings>
    <field name="logo_pic" sortOrder="10">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="dataType" xsi:type="string">string</item>
                <item name="source" xsi:type="string">logo_pic</item>
                <item name="label" xsi:type="string" translate="true">Business Logo</item>
                <item name="visible" xsi:type="boolean">true</item>
                <item name="formElement" xsi:type="string">imageUploader</item>
                <item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
                <item name="previewTmpl" xsi:type="string">Magento_Catalog/image-preview</item>
                <item name="validation" xsi:type="array">
                    <item name="required-entry" xsi:type="boolean">true</item>
                </item>
                <item name="uploaderConfig" xsi:type="array">
                    <item name="url" xsi:type="url" path="professional/logo/upload/field/professional[logo_pic]"/>
                </item>
                <item name="notice" xsi:type="string" translate="true">The dimensions for the Logo should be 62 X 62 when uploading it.</item>
            </item>
        </argument>
    </field>
</fieldset>

1 Answer 1

0

Identified the root cause in custom DataProvider model's getData() function and applied the below fixes:

foreach ($collection->getData() as $row) {
     $logoPic = $row['logo_pic'];
     ...
}

Previous code:

foreach ($collection as $row) {
     $logoPic = $row->getLogoPic();
     ...
}

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.