getGroupName example

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

        return $cookieGroupCollection;
    }

    private function assignCookiesToGroups(CookieCollection $cookieCollection, CookieGroupCollection $cookieGroupCollection): void
    {
        /** @var CookieStruct $cookie */
        foreach ($cookieCollection as $cookie) {
            $cookieGroup = $cookieGroupCollection->getGroupByName($cookie->getGroupName());

            $cookie->setGroup($cookieGroup);
            $cookieGroup->addCookie($cookie);
        }
    }

    private function addDefaultGroups(CookieGroupCollection $cookieGroupCollection): void
    {
        $snippetNamespace = $this->snippetManager->getNamespace('frontend/cookie_consent/groups');

        $cookieGroupCollection->add(new CookieGroupStruct(CookieGroupStruct::TECHNICAL, $snippetNamespace->get('technical/title')$snippetNamespace->get('technical/description'), true));
        
Home | Imprint | This part of the site doesn't use cookies.