I am trying to: Use the view custom search filter with a standard formatted checkbox array instead of the toolset "Checkboxes" nested array.
I have an integration with another database that syncs over an array of values into a custom field type like so:
a:2:{i:0;s:5:"Test1";i:1;s:5:"Test2";}
When using a custom checkbox field using another solution (not Toolset), this format works perfectly and displays a list of checkbox values in my post type field. I can display these in my post and they show as a list of values elsewhere, but when attempting to use them within the views search filter, its a mess and shows the raw string from the database (a:2:{i:0;s:5:"Test1";i:1;s:5:"Test2";}).
When using a toolset checkboxes field, this works as I would like it to in the view search filter, but due to the nested array of toolset checkboxes, this doesn't match my integration synced data and thus fails to populate into the toolset checkboxes field correctly.
As you know, the toolset checkboxes data looks like this.
What i'd like to know is, how can I use my clean array of values (a:2:{i:0;s:5:"Test1";i:1;s:5:"Test2";}) inside a view's search filter, shown as a list of values that an end user can select?
Views "understands" Types custom fields, and so can handle post meta that is stored in a custom format (such as that for Types checkboxes fields).
Anything else it interprets as raw strings, so a serialized array such as a:2:{i:0;s:5:"Test1";i:1;s:5:"Test2";} just looks like a string to Views.
(I guess that is an ACF checkboxes field or some other 3rd-party implementation.)
The proprietary format used by Types for checkboxes fields is admittedly unwieldly and we don't have an official API for converting to or from it, but I have previously prepared an unofficial API function to do that which may help you so that you can transpose the existing format you are using to work with a Types checkboxes field that can be used in a Views filter.
Thanks for the details. The checkbox field in question is indeed ACF but I believe the array format is somewhat standard compared to the Types version. Either way, I'll see what I can do with the code you posted.
As an alternate approach, are there any search or filter plugins that are supported or recommended by Toolset over another? E.G., Facet WP or Search & Filter Pro? I'm guessing there is nothing directly supported since Toolset has the functionality built in, but are there any ones you know will work or will not conflict with toolset? I'm using Toolset blocks, types & maps.