Sylius: Custom grid show action lack documentation

Created on 21 Jun 2020  Â·  5Comments  Â·  Source: Sylius/Sylius

Sylius docs version: 1.x / latest

Description
Why the "Your first grid" guide is missing the show action:

app_admin_supplier:
    resource: |
        alias: app.supplier
        section: admin
        templates: SyliusAdminBundle:Crud
        except: ['show']      <------------------------ HERE

If one follows this tutorial, but want to have the "show" action, we end up with 500 error:

Unable to find template "SyliusAdminBundle:Crud:show.html.twig" (looked into: /var/www/html/vendor/knplabs/knp-menu/src/Knp/Menu/Resources/views, /var/www/html/templates, /var/www/html/templates, /var/www/html/vendor/symfony/twig-bridge/Resources/views/Form).
RFC Stale

All 5 comments

That's because there's no general way of "showing" a resource, which means there's no "show" template in the SyliusAdminBundle:Crud namespace. One must first create the template.

Probably some generic way of iterating over all of the fields could be useful. However, we need to think about testing it to avoid regression in the long term. PR would be welcome :)

A simple template with some fields, not necessarily all, will be better than nothing.
A table-like layout, with key-value pairs will be sufficient for a simple presentation.

Even a blank template with a message how to override this view would be more than helpful… instead of 500.

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in a week if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings