I'm using easyadmin
for my website. In order to manage a gallery of images I would like to display a thumbnail of each one of them wrapped in a link that lead to the actual show
action of the entity Image
here is the definition of the gallery :
Album:
class: App\Entity\Album
list:
fields:
- titre
- images
show:
fields:
- titre
- { property: images, template: admin/field_mosaic.html.twig }
And the custom template I have created :
<div class="gallery m-2">
{% for image in item.images %}
<a href="{{ path('easy_admin_bundle') }}?entity={{ link_parameters.entity }}&action={{ link_parameters.action }}&primary_key_name={{ link_parameters.primary_key_name }}&id={{ item.id }}">
<img class="rounded m-2" src="{{ asset(vich_uploader_asset(image, "imageFile"))|imagine_filter('profile_list') }}" alt="image #{{ loop.index }}">
</a>
{% endfor %}
</div>
Unfortunately I don't know the name of the main route of the easyadminbundle. I tried {{ path('admin') }}
which doesn't worked and the name in the routes\easy_admin.yaml
file which doesn't work either.
Where can I found it ?
After 10 min I decided to run a simple
$php bin/console debug:router
And I found this little one:
+--------------+------------------------------------------------------------------------------------------+
| Property | Value |
+--------------+------------------------------------------------------------------------------------------+
| Route Name | easyadmin |
| Path | /admindatabase/ |
| Path Regex | #^/admindatabase/$#sD |
| Host | ANY |
| Host Regex | |
| Scheme | ANY |
| Method | ANY |
| Requirements | NO CUSTOM |
| Class | Symfony\Component\Routing\Route |
| Defaults | _controller: EasyCorp\Bundle\EasyAdminBundle\Controller\EasyAdminController::indexAction |
| Options | compiler_class: Symfony\Component\Routing\RouteCompiler |
+--------------+------------------------------------------------------------------------------------------+
Sorry for bothering....