backdrop-ops / docs.backdropcms.org

Website for displaying Backdrop CMS documentation and API source code.
https://docs.backdropcms.org/
6 stars 6 forks source link

Expand discussion of extra keys properties for checkboxes and radios in FAPI #221

Closed bugfolder closed 1 year ago

bugfolder commented 1 year ago

We recently added discussion to https://docs.backdropcms.org/form_api#radios and https://docs.backdropcms.org/form_api#checkboxes pointing out that one can add description to the individual buttons by adding extra keys with #description properties. This discussion should be expanded to note that other properties could be added the same way (and which ones).

Also, if/when https://github.com/backdrop/backdrop-issues/issues/5999 is merged, the #indentation property will be one of these.

bugfolder commented 1 year ago

Since the changes will probably be done all the same time, I'll wrap adding #indentation into this task (see https://github.com/backdrop/backdrop-issues/issues/5999#issuecomment-1457219612). Include it in all elements themed by theme_form_element() or theme_container(). (@argiepiano, anything else to add to this?)

argiepiano commented 1 year ago

@argiepiano, anything else to add to this?

That's it! Thanks.

bugfolder commented 1 year ago

One more thing to add, which is related: #options should warn people not to mix integer and string keys in an option list, because when PHP compares integers to strings (something that's likely to happen anytime someone is checking whether a particular key was chosen), it casts the strings to integers, which can give unexpected results. See https://github.com/backdrop/backdrop-issues/issues/6024.

quicksketch commented 1 year ago

https://github.com/backdrop/backdrop-issues/issues/5999 has been merged, great work @argiepiano and @bugfolder! When #indentation is added, please remove "Needs Documentation" from that issue.

bugfolder commented 1 year ago

Documentation created: https://docs.backdropcms.org/form_api#indentation.

Also added some discussion discouraging mixing key types to https://docs.backdropcms.org/form_api#options_property.

klonos commented 1 year ago

Thanks for working on documenting these things @bugfolder 🙏🏼