Fix using HtmlString for HasIcon
Description
Tried to fix this issue on Discord: https://discord.com/channels/883083792112300104/1254017792902959124
According to the docs you should be able to pass a view to register an icon alias. This gets casted to a string though and is then outputted as an image.
Also view() doesn't work. I think the issue is that View gets converted to string when passed as a Blade component param. Not sure how to fix this. I think the issue is how we pass $icon in actions/resources/views/components/action.blade.php.
CC: @zepfietje not sure how this was intended to work. Maybe you can have a look at this.
Functional changes
- [ ] Code style has been fixed by running the
composer cscommand. - [ ] Changes have been tested to not break existing functionality.
- [x] Documentation is up-to-date.
@pxlrbt
I think the issue is that View gets converted to string when passed as a Blade component param
It only happens when passing Renderables's. Htmlable's are fine. I've raised an issue with the Laravel team. It feels like a bug, but perhaps there's a good reason for it.
As discussed -- this may be a breaking change and not the solution short term.
See: https://github.com/laravel/framework/issues/51889
Please swap it to use Htmlable and get rid of the HtmlString wrapper. If we need to do extra processing into an HtmlString internally once its passed in then we will do that, but this PR can still be updated as such for now until we have a response from Laravel.
Is there anything I can do to help with this PR?
I would welcome a PR to fix this, but this isn't the right way to go about it IMO. You should be able to pass in a View object as per the docs without having to wrap within an HtmlString.