addDefaultCookies example


        $this->eventManager = $eventManager;
        $this->snippetManager = $snippetManager;
        $this->config = $config;
    }

    public function collect(): CookieGroupCollection
    {
        $cookieGroupsCollection = $this->collectCookieGroups();

        $cookieCollection = new CookieCollection();
        $this->addDefaultCookies($cookieCollection);

        $this->eventManager->collect(
            'CookieCollector_Collect_Cookies',
            $cookieCollection
        );

        if (!$cookieCollection->isValid()) {
            throw new InvalidCookieItemException(sprintf('Found item inside cookie collection, which is not of type \Shopware\Bundle\CookieBundle\Structs\CookieStruct'));
        }

        $cookieCollection = $this->sortCookies($cookieCollection);
        
Home | Imprint | This part of the site doesn't use cookies.