-
Notifications
You must be signed in to change notification settings - Fork 1
How to use
Teyir edited this page Sep 16, 2024
·
1 revision
Include the cookie consent logic after
opening tag:<?php
if (PackageController::isInstalled('Simplecookies')) {
CMW\Controller\Simplecookies\SimpleCookiesController::getInstance()->showCookieConsent();
}
?>
In your theme folder create a new directory "SimpleCookies", ex Public/Themes/$theme/Views/SimpleCookies
Create 2 files:
Create a file cookies.banner.php
.
This is an exemple:
<?php
use CMW\Manager\Env\EnvManager;
use CMW\Manager\Security\SecurityManager;
use CMW\Model\Simplecookies\SimpleCookiesModel;
//Import the SimpleCookies settings
$settings = SimpleCookiesModel::getInstance()->getSettings();
?>
<div class="cookies-consent">
<h1><?= $settings->getBannerTitle() ?></h1>
<?= $settings->getPageContent() ?>
<form action="<?= EnvManager::getInstance()->getValue('PATH_URL') . 'api/cookies/consent' ?>" method="post">
<?php (new SecurityManager())->insertHiddenToken(); ?>
<button type="submit" name="consent" value="1">OK</button>
</form>
</div>
Create a file main.view.php
.
This is an exemple:
<?php
use CMW\Utils\Website;
/* @var string $content */
Website::setTitle("Cookies");
Website::setDescription("Informations sur les cookies que nous stockons sur le site " . Website::getWebsiteName());
?>
<section class="cookies-container">
<?= $content ?>
</section>