shopware / admin-extension-sdk

The Admin Extension SDK can be used by Shopware 6 apps and plugins. This library allows them to extend the administration with custom functionality.
https://developer.shopware.com/resources/admin-extension-sdk/
46 stars 13 forks source link

How to add a new route with location? #100

Open niklaswolf opened 10 months ago

niklaswolf commented 10 months ago

I don't see how I can link to another location from the documentation, only how to update the URL.

My usecase is building a new CRUD interface for a custom entity. I have added successfully a new menu entry which links to a new location. The location renders a new listing of entries using the SwEntityListing component (https://component-library.shopware.com/components/sw-entity-listing). I followed this guide a I don't want/need to build a whole new app (https://shopware.github.io/admin-extension-sdk/docs/guide/getting-started/usage#using-locations-with-normal-vue-components-without-iframe-rendering).

Now I want/need to build the detail page for the entries and link from the listing to the detail page. How do I register another route/page (the detail route) so that I can pass it to the EntityListing component? How do I associate the new route with a location so that I can inject the detail-page component there?

jleifeld commented 10 months ago

Normally routing inside your module have to be done by implementing custom routes inside the iFrame. Without using the iFrame approach you can use the "classic" plugin approach additionally to add a new route which you can use for your links: https://developer.shopware.com/docs/guides/plugins/plugins/administration/add-custom-route.html The route can render your component

niklaswolf commented 10 months ago

Thanks @jleifeld , I'll try it this way :)