Right way to exclude specific enum options within ->options?
Say you have a column in your model casted as an Enum.
The enum class has getLabel, getColor, getIcon implemented.
Doing just the following in a forms select/togglebutton/etc component:
Will render Labels, Icons, and Color. Great!
However, say I have 5 different cases, but a few of those cases are excluded from say a Select or Togglebutton form element due to tenancy reasons.
Previously creating and using a custom getOptionsArray was fine, I could exclude (except) it like this:
However this won't render the labels, icons, or colors as it returns an array.
Currently when say I want to exclude specific options - i do something like this:
This obviously excludes the right stuff and renders the proper icon and color too. I was wondering if there is a more elegant approach than the above?
0 Replies