diff --git a/Api/CookieHandlerInterface.php b/Api/CookieHandlerInterface.php index 544dfc4..f2f99d4 100644 --- a/Api/CookieHandlerInterface.php +++ b/Api/CookieHandlerInterface.php @@ -14,11 +14,6 @@ interface CookieHandlerInterface { - /** - * @var string Cookie name. - */ - const COOKIE_NAME = 'm_cookie-law-banner'; - /** * Check if cookie exists. * diff --git a/Block/Banner.php b/Block/Banner.php index 3e91681..6c1326c 100644 --- a/Block/Banner.php +++ b/Block/Banner.php @@ -60,8 +60,10 @@ public function _prepareLayout() */ public function getIsEnabled() { - if ($this->helperData->isActive() && !$this->cookieHandler->exists()) - { + if ( + $this->helperData->isActive() && + $this->cookieHandler->exists() === false + ) { return true; } return false; @@ -74,7 +76,11 @@ public function getIsEnabled() */ public function getTitle() { - return $this->helperData->getTitle(); + $title = $this->helperData->getTitle(); + if (empty($title)) { + return false; + } + return $title; } /** @@ -94,7 +100,11 @@ public function getMessage() */ public function getInfoMessage() { - return $this->helperData->getInfoMessage(); + $info = $this->helperData->getInfoMessage(); + if (empty($info)) { + return false; + } + return $info; } /** @@ -104,7 +114,11 @@ public function getInfoMessage() */ public function getInfoLink() { - return $this->helperData->getInfoLink(); + $link = $this->helperData->getInfoLink(); + if (empty($link)) { + return false; + } + return $link; } /** diff --git a/CHANGELOG.md b/CHANGELOG.md index 15e04be..bc1b6c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Changelog All notable changes to this project will be documented in this file. -## [1.0.4] - 2018-07-24 +## [1.0.0] - 2018-07-26 ### Added - CMS module settings (Enable/Disable) - Initial feature \ No newline at end of file diff --git a/Model/CookieHandler.php b/Model/CookieHandler.php index 4d5ad56..ba62d4b 100644 --- a/Model/CookieHandler.php +++ b/Model/CookieHandler.php @@ -17,6 +17,11 @@ class CookieHandler implements CookieHandlerInterface { + /** + * @var string Cookie name. + */ + const COOKIE_NAME = 'm_cookie-law-banner'; + /** * @var \Magento\Framework\Stdlib\CookieManagerInterface */ @@ -36,9 +41,6 @@ public function __construct( */ public function exists() { - if (empty($this->cookieManager->getCookie(self::COOKIE_NAME))) { - return false; - } - return true; + return $this->cookieManager->getCookie(self::COOKIE_NAME, false); } } diff --git a/README.md b/README.md index 7b4c586..ec2f67e 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,10 @@ Cookie Law Banner for Magento 2 ===================== -A simple way that allows the integration of a Floating Buy Button in your store; -No matter how much content it has, like, long product description or a lot of -reviews, the button follow your customers along each product page. Bringing the -product name, price and of course, the buy button. -Get your customer attention the most important action in your online store, the -purchase. +This extension allow you to setup a Cookie Law Banner to inform your customers +about the Cookie Privacy. This extension is also fully customizable, you're +able to change the title, description, link and button text. Also compatible +mobile version. [![Packagist](https://img.shields.io/packagist/v/magestat/module-cookie-law-banner.svg)](https://packagist.org/packages/magestat/module-cookie-law-banner) @@ -43,7 +41,7 @@ php bin/magento cache:clean 1. Go to **Stores** > **Configuration** > **Magestat** > **Cookie Law Banner**: 2. In **Enable Module** tab, select **Enabled** option to enable module. -3. In **Settings** tab, Fill the fields as you need. +3. In **Settings** tab, Fill the fields as you want. ## Contribution diff --git a/etc/config.xml b/etc/config.xml index 075c19c..a057cf7 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -16,7 +16,7 @@ Cookies Control We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it. - More info +
More info
/privacy-policy-cookie-restriction-mode
diff --git a/view/frontend/templates/banner.phtml b/view/frontend/templates/banner.phtml index 227b78d..d244a01 100644 --- a/view/frontend/templates/banner.phtml +++ b/view/frontend/templates/banner.phtml @@ -8,22 +8,36 @@ * http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * Please see LICENSE.txt for the full text of the OSL 3.0 license * - * @var $block \Magestat\CookieLawBanner\Block\CookieLawBanner + * @var $block \Magestat\CookieLawBanner\Block\Banner */ ?> +getTitle(); + +// Instanciate block link. +$link = $block->getInfoLink(); + +// Instanciate block info message. +$info = $block->getInfoMessage(); +?> getIsEnabled()): ?>