简体   繁体   中英

EasyAdmin Bundle - Symfony

I work with EasyAdmin and I don't know how to add an image in list view.

I would like to add next to the prices two pictures (simply 2 logos) with a link to the website in question. The admin can click on logo A or B who redirect to the website.

I can insert my links with entiy's priority (Interface with links).

链接界面 .

Here is my code:

app/config/config.yml

list:
fields:
    - { property: 'low_amz', label: 'Amazon' }
    - { property: 'url_amz', label: 'Amz', type: 'url' }

    - { property: 'low_pm', label: 'PriceMinister' }
    - { property: 'url_pm', label: 'Pm', type: 'url' }

But how I replace these link's value with my images. The images are stocked in local.

With my thumbnails, it works:

 - { property: 'urlPdtImg', type: 'image', label: ' ' }

But in my case, I want just to change the value "string" in img. Of course, this does not work:

- { property: 'url_pm', label: 'Pm', type: 'url', base_path: '/img/Amazon.svg' }}


EasyAdmin Bundle 1.17.12
Symfony 3.4

Have a nice day.

Here are my files:

File config.yml:

- { property: 'url_amz', label: ' ', type: 'url', template: 'easy_admin/fields/_url1.html.twig' }

File _url.html.twig

<a href="{{ value }}">
<img src="{{ asset('Img/PM.svg') }}" alt="Amazon logo" style="height: 30px;"/>

Result

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM