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.
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.
The
toIcon()
field method throws an error if no fallback is passed:This results in this error:
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.