SyliusResourceBundle icon indicating copy to clipboard operation
SyliusResourceBundle copied to clipboard

Add getSection at ResourceControllerEvent

Open igormukhingmailcom opened this issue 6 years ago • 6 comments

Describe the proposed solution Add setSection to ResourceControllerEvent and pass section from request configuration:

        // sylius/resource-bundle/src/Bundle/Controller/EventDispatcher.php
        // ...
        $event = new ResourceControllerEvent($resource);
        $event->setSection($requestConfiguration->getSection());

Alternative solution Add whole requestConfiguration to event.

Additional context When we subscribe to (for example) sylius.product.show event to embed some tracker html code like Google tag manager - we don't want to embed it at admin area. So we should somehow know what section (shop, admin, admin_api, etc) we're at to skip non-shop sections.

I will provide PR if this idea looks good for core team.

igormukhingmailcom avatar Sep 17 '19 07:09 igormukhingmailcom

That's a reasonable expectation. Thanks for the report.

ztellman avatar Jun 13 '14 17:06 ztellman

Ditto.

olewhalehunter avatar Jun 30 '14 18:06 olewhalehunter

This is fixed in the 0.4.0 release.

ztellman avatar Nov 10 '14 18:11 ztellman