Skip to content

Commit

Permalink
Merge pull request #315 from helsingborg-stad/fix/checkbox-not-clickable
Browse files Browse the repository at this point in the history
Fix: Accept empty values
  • Loading branch information
Anna authored Jul 12, 2023
2 parents fdb3f7a + 386881c commit 5efa884
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions source/php/Component/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ public function sanitizeInlineCss($inlineCss)
public static function buildAttributes(array $attributes): string
{
$attributeStrings = [];

foreach ($attributes as $key => $value) {
if (is_object($value) || is_array($value)) {
$value = json_encode($value);
Expand All @@ -405,7 +405,9 @@ public static function buildAttributes(array $attributes): string
$value = strval($value);
}

if (!is_string($value)) return "";
if (!is_string($value) && !empty($value)) {
return "";
};

$escapedValue = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
$attributeStrings[] = "$key=\"$escapedValue\"";
Expand Down

0 comments on commit 5efa884

Please sign in to comment.