Skip to content

Commit

Permalink
Added Message & Dismiss value
Browse files Browse the repository at this point in the history
  • Loading branch information
cinghie committed Jun 10, 2015
1 parent 56d6bb8 commit ffb6818
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ You can load the CookieConsent Widget like this:
use cinghie\cookieconsent\widgets\CookieWidget;
<?= CookieWidget::widget( [
'message' => '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'
Expand Down
15 changes: 15 additions & 0 deletions widgets/CookieWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

class CookieWidget extends Widget
{
public $message;
public $dismiss;
public $learnMore;
public $link;
public $theme;
Expand All @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions widgets/views/cookieWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}'
Expand Down

0 comments on commit ffb6818

Please sign in to comment.