Priority for breadcrumb blocks
Closed this issue · 1 comments
core23 commented
Subject
At the moment it is not possible to override a breadcrumb block with the same context
. This could be fixed by defining a priority.
Steps to reproduce
Define two breadcrumb services with the news_post
context.
<service id="sonata.news.block.breadcrumb_post" class="Sonata\NewsBundle\Block\Breadcrumb\NewsPostBreadcrumbBlockService">
<tag name="sonata.block"/>
<tag name="sonata.breadcrumb"/>
<argument>news_post</argument>
<argument>sonata.news.block.breadcrumb_post</argument>
<argument type="service" id="templating"/>
<argument type="service" id="knp_menu.menu_provider"/>
<argument type="service" id="knp_menu.factory"/>
<argument type="service" id="sonata.news.blog"/>
</service>
<service id="custom.news.block.breadcrumb_post" class="Custom\NewsBundle\Block\Breadcrumb\NewsPostBreadcrumbBlockService">
<tag name="sonata.block"/>
<tag name="sonata.breadcrumb"/>
<argument>news_post</argument>
<argument>custom.news.block.breadcrumb_post</argument>
<argument type="service" id="templating"/>
<argument type="service" id="knp_menu.menu_provider"/>
<argument type="service" id="knp_menu.factory"/>
<argument type="service" id="sonata.news.blog"/>
</service>
Call the breadcrumb rendern for the news_post
context in twig template:
{{ sonata_block_render_event('breadcrumb', { 'context': 'news_post', 'post': post, 'current_uri': app.request.requestUri }) }}
Expected results
The last defined breadcrumb will be used.
Actual results
The first matching block is used.
stale commented
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.