Skip to content

Commit

Permalink
Theme colors not being used (#68)
Browse files Browse the repository at this point in the history
* Fix primary color on login two factor page

* Fix styling

* wip

* Force primary color from current panel

---------

Co-authored-by: Baspa <[email protected]>
  • Loading branch information
Baspa and Baspa authored Dec 17, 2024
1 parent b195e59 commit 8b12742
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion resources/views/auth/login-two-factor.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{{ $this->form }}

<div class="flex items-center justify-between mt-6">
<x-filament::button type="submit" class="w-full" color="primary">
<x-filament::button type="submit" class="w-full" style="background-color: {{ filament()->getCurrentPanel()->getColors()['primary'] }};">
{{ __('Login') }}
</x-filament::button>
</div>
Expand Down

1 comment on commit 8b12742

@MatticusPrime29
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This introduces a bug:

htmlspecialchars(): Argument #1 ($string) must be of type string, array given

in this method from vendor/laravel/framework/src/Illuminate/Support/helpers.php :

function e($value, $doubleEncode = true)
    {
        if ($value instanceof DeferringDisplayableValue) {
            $value = $value->resolveDisplayableValue();
        }

        if ($value instanceof Htmlable) {
            return $value->toHtml();
        }

        if ($value instanceof BackedEnum) {
            $value = $value->value;
        }

        return htmlspecialchars($value ?? '', ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8', $doubleEncode);
    }

Called from this blade component:

<?php $component->withAttributes(['type' => 'submit','class' => 'w-full','style' => 'background-color: '.e(filament()->getCurrentPanel()->getColors()['primary']).';']); ?>

The value passed into e() is expected to be a string. But filement()->getCurrentPanel()->getColors()['primary'] is an array

Please sign in to comment.