Skip to content

Commit

Permalink
Custom Cookie improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
DirkPersky committed Apr 21, 2024
1 parent 46ca881 commit fe2183e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Classes/Domain/Model/Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ public function getType(): string
{
switch ($this->category) {
case '3':
$type = strtolower($this->categoryName);
$type = strtolower(trim(preg_replace('/[^A-Za-z0-9-]+/', '-',$this->categoryName)));
break;
case '1':
$type = 'statistics';
Expand Down
17 changes: 2 additions & 15 deletions Classes/ViewHelpers/CookiesViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,14 @@ public function render()

foreach ($cookies as $cookie) {
$category = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('cookie.category.' . $cookie->getCategory(), 'dp_cookieconsent');

switch ($cookie->getCategory()) {
case '0':
$field = 'required';
break;
case '1':
$field = 'statistics';
break;
case '2':
$field = 'marketing';
break;
default:
$field = $cookie->getCategoryName();
}
$field = $cookie->getType();
if ($cookie->getCategory() == 3) {
$category = $cookie->getCategoryName();
}
if (!$category) continue;

if (!isset($data[$category])) $data[$category] = [
'field' => strtolower($field),
'field' => $field,
'name' => $category,
'cookies' => []
];
Expand Down

0 comments on commit fe2183e

Please sign in to comment.