2

How do i display custom image only in admin edit form .. But dont want choose file button

code:

 $fieldset->addField(
                'file_path','image', [
                    'name' => 'file_path',
                    'label' => __('Logo Image'),
                    'title' => __('Logo Image'),
                    'renderer'  => 'Vendor\Module\Block\Adminhtml\Quotation\Renderer\LogoImage',
                ]
            );

enter image description here

1

1 Answer 1

1

Just use type 'image' and it will show you the last uploaded image in thumbnail

$fieldset->addField(
    'file_path',
    'image',
    [
        'name' => 'file_path',
        'label' => __('Logo Image'),
        'title' => __('Logo Image'),
        'disabled' => $isElementDisabled
    ]
);

You don't need to use renderer in it

3
  • want to display image alone need not all these button labels and all
    – Gomathi
    Commented Mar 4, 2019 at 12:03
  • Magento uses form elements in admin forms, you cannot show just image here, it should be and element (input, select etc). But you can show uploaded image on grid, but not on form. I don't think this is possible in magento Commented Mar 4, 2019 at 12:52
  • ya.. i can disabled but i could not hide button and labels
    – Gomathi
    Commented Mar 4, 2019 at 12:59

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.