rasteiner / k3-awesome-picker

Kirby 4 field plugin to show and select a free Font Awesome icon.
MIT License
14 stars 0 forks source link

toIcon() throws an error if no fallback is passed #16

Closed MoritzLost closed 1 year ago

MoritzLost commented 1 year ago

The toIcon() field method throws an error if no fallback is passed:

$icon = $page->icon()->toIcon();

This results in this error:

Too few arguments to function Kirby\Filesystem\F::{closure}(), 1 passed in [project]/vendor/getkirby/cms/src/Cms/Field.php on line 78 and exactly 2 expected

The fallback should probably be optional? In this case, all the function needs is a default value so it can be used without the fallback.

rasteiner commented 1 year ago

Yes, it's actually in the code since April, I have just forgot to create a release. Should be fixed in 0.2.1: an invalid icon with no fallback value returns null.

MoritzLost commented 1 year ago

@rasteiner Thanks for the quick resolution! 🚀