Cookie helper @api
- Since
- 100.0.2
Definition at line 13 of file Cookie.php.
◆ __construct()
- Parameters
-
\Magento\Framework\App\Helper\Context | $context | |
\Magento\Store\Model\StoreManagerInterface | $storeManager | |
array | $data | |
- Exceptions
-
Definition at line 47 of file Cookie.php.
52 parent::__construct($context);
55 if (!$this->_currentStore instanceof \
Magento\Store\Model\Store) {
56 throw new \InvalidArgumentException(
'Required store object is invalid');
61 if (!$this->_website instanceof \
Magento\Store\Model\Website) {
62 throw new \InvalidArgumentException(
'Required website object is invalid');
◆ _getAcceptedSaveCookiesWebsites()
_getAcceptedSaveCookiesWebsites |
( |
| ) |
|
|
protected |
Get accepted save cookies websites
- Returns
- array
Definition at line 110 of file Cookie.php.
112 $unSerializedList =
null;
113 $serializedList = $this->_request->getCookie(self::IS_USER_ALLOWED_SAVE_COOKIE,
false);
114 if ($serializedList) {
115 $unSerializedList = json_decode($serializedList,
true);
117 return is_array($unSerializedList) ? $unSerializedList : [];
◆ getAcceptedSaveCookiesWebsiteIds()
getAcceptedSaveCookiesWebsiteIds |
( |
| ) |
|
Return serialized list of accepted save cookie website
- Returns
- string
Definition at line 98 of file Cookie.php.
101 $acceptedSaveCookiesWebsites[(int)$this->_website->getId()] = 1;
102 return json_encode($acceptedSaveCookiesWebsites);
_getAcceptedSaveCookiesWebsites()
◆ getCookieRestrictionLifetime()
getCookieRestrictionLifetime |
( |
| ) |
|
Get cookie restriction lifetime (in seconds)
- Returns
- int
Definition at line 125 of file Cookie.php.
127 return (
int)$this->scopeConfig->getValue(
128 self::XML_PATH_COOKIE_RESTRICTION_LIFETIME,
129 \
Magento\Store\Model\ScopeInterface::SCOPE_STORE,
◆ isCookieRestrictionModeEnabled()
isCookieRestrictionModeEnabled |
( |
| ) |
|
Check if cookie restriction mode is enabled for this store
- Returns
- bool
- Since
- 100.1.3
Definition at line 84 of file Cookie.php.
86 return $this->scopeConfig->getValue(
87 self::XML_PATH_COOKIE_RESTRICTION,
88 \
Magento\Store\Model\ScopeInterface::SCOPE_STORE,
◆ isUserNotAllowSaveCookie()
isUserNotAllowSaveCookie |
( |
| ) |
|
Check if cookie restriction notice should be displayed
- Returns
- bool
Definition at line 71 of file Cookie.php.
75 empty($acceptedSaveCookiesWebsites[$this->_website->getId()]);
_getAcceptedSaveCookiesWebsites()
isCookieRestrictionModeEnabled()
◆ $_currentStore
◆ $_website
◆ IS_USER_ALLOWED_SAVE_COOKIE
const IS_USER_ALLOWED_SAVE_COOKIE = 'user_allowed_save_cookie' |
◆ XML_PATH_COOKIE_RESTRICTION
const XML_PATH_COOKIE_RESTRICTION = 'web/cookie/cookie_restriction' |
Path to configuration, check is enable cookie restriction mode
Definition at line 23 of file Cookie.php.
◆ XML_PATH_COOKIE_RESTRICTION_LIFETIME
const XML_PATH_COOKIE_RESTRICTION_LIFETIME = 'web/cookie/cookie_restriction_lifetime' |
The documentation for this class was generated from the following file: