-
-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix for is pro not installed #295
Conversation
PR Summary
|
I see now if not pro: an empty array item. But why not the array_filter() ? As it completely removes that item from the list. .. |
🤔 can you explain how to use it with conditional array item? ...Bolt::hasPro() ? \LaraZeus\BoltPro\Facades\GradeOptions::schema($field) : [], |
well i only meant it for this function: public static function getOptionsHidden(): array
{
return [
// @phpstan-ignore-next-line
Bolt::hasPro() ? \LaraZeus\BoltPro\Facades\GradeOptions::hidden() : null,
self::hiddenDataSource(),
self::hiddenVisibility(),
self::hiddenHtmlID(),
self::hiddenHintOptions(),
self::hiddenRequired(),
self::hiddenColumnSpanFull(),
];
} wrap the array with array_filter() function like so: public static function getOptionsHidden(): array
{
return array_filter([
// @phpstan-ignore-next-line
Bolt::hasPro() ? \LaraZeus\BoltPro\Facades\GradeOptions::hidden() : null,
self::hiddenDataSource(),
self::hiddenVisibility(),
self::hiddenHtmlID(),
self::hiddenHintOptions(),
self::hiddenRequired(),
self::hiddenColumnSpanFull(),
]);
} it will completely remove the null / empty array items, so you don't have an empty array item in the array which you return. Keeps the return array of getOptionsHidden() clean. |
you're right, but instead of duplicate the |
Ah didn't see that one in the commits. you already found a way. that's perfect! |
No description provided.