Configuration
Pimcore Backend
To configure the bundle:
- Go to the Backend Settings in Pimcore and navigate to
CoreShop
>Document Routes
. - Create a new document route by clicking the
+
button at the top corner.
This configuration allows you to link a Symfony Route Name, like “homepage,” with Pimcore Documents. For example, the route “homepage” can be linked to “/en” for English.
The Bundle supports Multi-Site and Multi-Language setups.
Usage in Twig or PHP
In Twig or PHP, use the route as shown below:
<div class="mb-3">
{% set doc = document_route_document('homepage') %}
{% if doc %}
Document Route Demo ({{ '{{ path(\'homepage\') }}' }}): {{ path('homepage') }} (ID: {{ doc.id }})
{% endif %}
</div>
NOTE: Using path('homepage') without a valid configuration will result in a RouteNotFoundException. The Twig Helper coreshop_route_document will return null if the route is not configured.