StorefrontHook example

 {
    }

    #[Route(path: '/storefront/script/{hook}', name: 'frontend.script_endpoint', requirements: ['hook' => '.+'], defaults: ['XmlHttpRequest' => true], methods: ['GET', 'POST'])]     public function execute(string $hook, Request $request, SalesChannelContext $context): Response
    {
        // blog/update => blog-update         $hookName = \str_replace('/', '-', $hook);

        $page = $this->pageLoader->load($request$context);

        $hook = new StorefrontHook($hookName$request->request->all()$request->query->all()$page$context);

        // hook: storefront-{hook}         $this->hook($hook);

        $fields = new ResponseFields(
            $request->get('includes', [])
        );

        $response = $hook->getScriptResponse();

        $symfonyResponse = $this->scriptResponseEncoder->encodeToSymfonyResponse(
            
Home | Imprint | This part of the site doesn't use cookies.