diff --git a/README.md b/README.md index 82f4855..bb41d69 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,8 @@ You can load the CookieConsent Widget like this: use cinghie\cookieconsent\widgets\CookieWidget; 'This website uses cookies to ensure you get the best experience on our website.', + 'dismiss' => 'Got It', 'learnMore' => 'More info', 'link' => 'http://silktide.com/privacy-policy', 'theme' => 'dark-bottom' diff --git a/widgets/CookieWidget.php b/widgets/CookieWidget.php index c783329..a2472f4 100644 --- a/widgets/CookieWidget.php +++ b/widgets/CookieWidget.php @@ -17,6 +17,8 @@ class CookieWidget extends Widget { + public $message; + public $dismiss; public $learnMore; public $link; public $theme; @@ -25,6 +27,19 @@ public function init(){ parent::init(); // Default Value + + if(!$this->message) { + $this->message = 'This website uses cookies to ensure you get the best experience on our website.'; + } else { + $this->message = $this->message; + } + + if(!$this->dismiss) { + $this->dismiss = 'Got It!'; + } else { + $this->dismiss = $this->dismiss; + } + if(!$this->learnMore) { $this->learnMore = 'More info'; } else { diff --git a/widgets/views/cookieWidget.php b/widgets/views/cookieWidget.php index 95befaf..159ac31 100644 --- a/widgets/views/cookieWidget.php +++ b/widgets/views/cookieWidget.php @@ -17,6 +17,8 @@ $asset = $this->assetBundles['cinghie\cookieconsent\assets\CookieAsset']; $this->registerJs("window.cookieconsent_options = { + message: '{$message}', + dismiss: '{$dismiss}', learnMore: '{$learnMore}', link: '{$link}', theme: '{$theme}'