Cookie consent
To automatically display explanations about the usage of cookies by the website, just set the parameter $cookieconsent
to true
.
The site will automatically display, whichever page is requested and only one time, a message at the very top of the page above the banner.
By using this website, you are accepting the use of cookies in accordance with our personal data policy. Note that cookies from this website are exempt from obtaining consent because strickly necessary to provide a service at the user’s request.
The view consent.phtml contains the text of the message.
consent.phtml
- <div id="consent">
- <p>By using this website, <b>you are accepting the use of cookies</b> in accordance with our personal data policy.
- <?php if (true): ?>
- <b>Note</b> that cookies from this website are exempt from obtaining consent because
- <i>strickly necessary to provide a service at the user’s request</i>.
- <?php endif; ?>
- <?php if (false): ?>
- <p>To learn more, <a class="clickhere" href="/en/legal-information" title="Legal information">click here</a>.
- <?php endif; ?>
- </p>
- <?php if ($confirmcookieconsent): ?>
- <p><span id="consentyes" class="clickit">I get it</span></p>
- <?php endif; ?>
- </div>
- <?php if ($confirmcookieconsent): ?>
- <?php head('javascript', 'js.cookie'); ?>
- <script>
- $('#consentyes').click(function() {
- Cookies.set('cookieconsent', 1, { path: '/', sameSite: 'lax' });
- $('#consent').hide();
- });
- </script>
- <?php endif; ?>
The view is built by the block banner.php which passes the variable $consent
to the view banner.phtml.
banner.php
- $is_admin = user_has_role('administrator');
- $is_writer = user_has_role('writer');
- $consent=false;
If $cookieconsent
is true
and if the cookie cookieconsent
isn't defined, creates the cookie cookieconsent
with a period of validity of one year and builds the view consent
.
Adapt the text according to the caracteristics of the website. If necessary, add a page which describes in détails the use of cookies, the information which is kept, and activate the link in consent.phtml.
Comments