Extension cookie_data_privacy
Anpassung für Opt-In
Standardmäßig ist die Extension "cookie_data_privacy" von Ghanshyam B. Gohel auf ein Opt-Out eingestellt.
Zwar suggeriert sie dem Besucher, dass er die Wahl hat, ob zum Beispiel Tracking-Cookies gesetzt werden oder nicht, setzt diese jedoch vom Einblenden des Cookie-Banners bis zum aktiven ablehnen von Cookies.
Unsere Anpassungen
Beim Aufruf, also solange der Status noch "leer" ist, wird automatisch von einer Annahme der Cookie ausgegagen.
Dies geschieht in der Datei
typo3ext/cookie_data_privacy/Classes/Controller/ShowCaseController.php
in den Zeilen 79 und 81.
<?php
namespace TYPO3Liebhaber\CookieDataPrivacy\Controller;
/***
*
* This file is part of the "Cookie Data Privacy" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2018 Ghanshyam B. Gohel <ghanshyam.typo3developer@gmail.com>
*
***/
/**
* ShowCaseController
*/
use TYPO3\CMS\Extbase\Utility\DebuggerUtility;
class ShowCaseController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
{
/**
* showCaseRepository
*
* @var \TYPO3Liebhaber\CookieDataPrivacy\Domain\Repository\ShowCaseRepository
* @inject
*/
protected $showCaseRepository = null;
/**
* privacyConfigRepository
*
* @var \TYPO3Liebhaber\CookieDataPrivacy\Domain\Repository\PrivacyConfigRepository
* @inject
*/
protected $privacyConfigRepository = null;
/**
* action list
*
* @return void
*/
public function listAction()
{
$showCases = $this->showCaseRepository->findAll();
$this->view->assign('showCases', $showCases);
}
/**
* action show
*
* @return void
*/
public function showAction()
{
$GLOBALS['TSFE']->set_no_cache(); // set no cache for multi-language switch
$cookie_status = $_COOKIE['cookieconsent_status'];
$rootPageUid = 0;
foreach ($GLOBALS['TSFE']->rootLine as $rootline) {
if ($rootline['is_siteroot']) {
$rootPageUid = (int)$rootline['uid'];
break;
}
}
$privacyConfigs = $this->privacyConfigRepository->findByRootPageUid($rootPageUid);
$formIdsString = '';
if($privacyConfigs[0]->getFormId()){
$formIdsArr = explode(',',$privacyConfigs[0]->getFormId());
array_walk($formIdsArr, function(&$value, $key) { $value = '#'.$value; } );
$formIdsString = implode(',',$formIdsArr);
}
$this->view
->assign('privacyConfig', $privacyConfigs[0])
->assign('formIdsString', $formIdsString);
if ($cookie_status === 'allow') {
$this->view->assign('status', 1);
} elseif (empty($cookie_status) || $cookie_status === 'deny') {
// delete all cookie 100% DSGVO fullfiellment
/*$_COOKIE = array();
$_COOKIE['cookieconsent_status'] = $cookie_status;*/
$this->view->assign('status', 0);
}
}
}
cookie_data_privacy im TER
getestet
Getestet haben wir dies in aktuellen Installationen mit folgenden Basics:
TYPO3 v9
cookie_data_privacy (9.1.0)
Grundsätzlich würden die Anpassungen auch mit Version 9.1.1 funktionieren. Da hier jedoch kein Reload der Seite mehr erfolgt, wird der Wechsel der Einstellungen erst beim Wechsel zur nächsten Seite oder Reload übernommen.


