RE: on the public side it just displays the KEY of the radio button (i.e. not_supported) as opposed the NAME “Not Supported” … What do I need to do to change the card.php and card-single.php files to show the NAME of the button instead?
What you are seeing is correct as the key
is the value saved in the database. Dealing with radios, dropdowns, and checkboxes are more challenging when compared to the text fields.
I deal with these by creating helper functions. It is probably easier to explain with an example. So let use the free Education Levels addon.
If you look at this line of code you’ll see I called a helper function to add the options instead of adding them directly to the fields array:
Here’s the link to that helper function:
As you see, it simply returns the array that you would have added to the fields array when registering the field.
To get the name of the option, in the template, get the key as you already did and created another helper function to get the name.
Here’s a link that that helper function use in the addon:
The add-on uses a Content Block to display the output in a template, so there is not a specific example I can give you. But, you only really need to register the field and use the two helper functions to get it to display in the template.
If you open a support ticket and attached your code, zipped, I can use your code and create a working example that you can build from.
RE: what about CVS Import / Export? do I just use the code as found on the Customize Text Field page but change the field_id info to match my radio buttons?
You could, but in the CSV file, you would get the key saved in the database and not the name. Depending on your use, that might be desired. If you want to import to and from by the name and not the key. That is trickier because you need to transform the key and name during import/export. Here’s I do it in the Education add-on:
- https://github.com/Connections-Business-Directory/Education-Levels/blob/master/connections_education_levels.php#L314-L333
- https://github.com/Connections-Business-Directory/Education-Levels/blob/master/connections_education_levels.php#L362-L381
You’ll notice that I use the same helper function that was used when registering the field.
I hope this helps!