[FIX] Fix checkboxlist not showing options when in preview / disabled
Previously, the condition elseif (!$readOnly && count($fieldOptions)) would prevent valid options being rendered when the $readOnly var is true ($readOnly = $this->previewMode || $field->readOnly || $field->disabled;).
This seems to be incorrect, the correct approach should be to show all options but mark them all as disabled.
This changes:

To:

Hmm, might be a bit of a subjective call, but I personally would prefer it to hide options that aren't selected when in preview mode, especially if it's a long checkbox list.
Would your changes also make this condition block redundant?
@bennothommo our specific use case is showing a preview of the field in a visual formbuilder so we would want all options to be displayed.
This pull request will be closed and archived in 3 days, as there has been no activity in this pull request for the last 6 months. If you intend to continue working on this pull request, please respond within 3 days. If this pull request is critical for your business, please reach out to us at [email protected].
My preference is still the same, but perhaps the preview state can be configurable? (ie. showOnPreview: all|checked|unchecked)
Whats the status on this @jaxwilko @bennothommo?
As indicated before, I still have the same preference.
If nobody is asking for it now maybe we just close it and revisit in the future if there is demand.
From my side of things, I still reckon the most user friendly way to do it would be to show all options but have each input marked as disabled as then people with only preview permission would be able to see all options avaliable even if they could not interact with any of them. Not massively opposed to showOnPreview, but it adds more complexity to an already complex system which may not be preferable.
I'm fine with merging this and if it becomes a problem in the future that too many options are shown on the preview screen then a hideWhenReadonly or similar option can be added at that point.