Skip to content

Commit

Permalink
BUGFIX: addContextualConsent needs to be more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Heinze committed Dec 16, 2021
1 parent f2c5e03 commit 16f4f48
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions Classes/Eel/Helper/CookiePunch.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,18 @@ public function blockTags(array $tagNames, string $markup, bool $enabled = true,
* @param string $service
* @return string
*/
public function addContextualConsent(
string $service,
string $markup,
bool $isEnabled = true
) {
$this->validateService($service);
if ($isEnabled) {
return '<div data-name="' . $service . '">' . $markup . "</div>";
} else {
return $markup;
public function addContextualConsent(?string $service, string $markup, bool $isEnabled = true) {
// service can be null e.g. if nothing is selected for `Sandstorm.CookiePunch:Mixin.ConsentServices`
// in the inspector
if($service) {
$this->validateService($service);
if ($isEnabled) {
return '<div data-name="' . $service . '">' . $markup . "</div>";
} else {
return $markup;
}
}
return $markup;
}

private function addNeverBlockAttribute(string $tag): string {
Expand Down

0 comments on commit 16f4f48

Please sign in to comment.