Skip to content

Commit

Permalink
Merge pull request #420 from infinum/tw-boolean-options-fix
Browse files Browse the repository at this point in the history
TW bool checking
  • Loading branch information
goranalkovic-infinum authored Aug 21, 2024
2 parents feb9c13 + 6e4967c commit ed2ab29
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Helpers/TailwindTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ public static function getTwDynamicPart($part, $attributes, $manifest, ...$custo

$value = Helpers::checkAttr($attributeName, $attributes, $manifest, true);

if (\is_bool($value)) {
$value = $value ? 'true' : 'false';
}

if ($responsive ? empty($value['_default'] ?? '') : !$value) {
continue;
}
Expand Down Expand Up @@ -175,6 +179,10 @@ public static function getTwClasses($attributes, $manifest, ...$custom)

$value = Helpers::checkAttr($attributeName, $attributes, $manifest, true);

if (\is_bool($value)) {
$value = $value ? 'true' : 'false';
}

if ($responsive ? empty($value['_default'] ?? '') : !$value) {
continue;
}
Expand Down Expand Up @@ -227,6 +235,10 @@ public static function getTwClasses($attributes, $manifest, ...$custom)
foreach ($conditions as $key => $attrConditions) {
$value = Helpers::checkAttr($key, $attributes, $manifest, true);

if (\is_bool($value)) {
$value = $value ? 'true' : 'false';
}

$isArrayCondition = \is_array($attrConditions);

if (!$value) {
Expand Down

0 comments on commit ed2ab29

Please sign in to comment.