addDefaultGroups example

$this->assignCookiesToGroups($cookieCollection$cookieGroupsCollection);

        $cookieGroupsCollection = $this->eventManager->filter('CookieCollector_Filter_Collected_Cookies', $cookieGroupsCollection);

        return $cookieGroupsCollection;
    }

    public function collectCookieGroups(): CookieGroupCollection
    {
        $cookieGroupCollection = new CookieGroupCollection();

        $this->addDefaultGroups($cookieGroupCollection);

        $this->eventManager->collect(
            'CookieCollector_Collect_Cookie_Groups',
            $cookieGroupCollection
        );

        if (!$cookieGroupCollection->isValid()) {
            throw new InvalidCookieGroupItemException('Found item inside cookie group collection, which is not of type \Shopware\Bundle\CookieBundle\Structs\CookieGroupStruct');
        }

        return $cookieGroupCollection;
    }
Home | Imprint | This part of the site doesn't use cookies.