Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optionally set checkbox values as 'true' or 'false' #682

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

goldenapples
Copy link
Contributor

@goldenapples goldenapples commented Dec 29, 2016

Adds the attribute option 'explicitbool' for checkboxes. If a checkbox is registered with 'explicitbool' => true, then the shortcode will be formatted with that attribute string like attribute="false" if unchecked. If the shortcode attributes are retrieved using the shortcode tag as the third parameter to shortcode_atts(), then this value will be converted back to a boolean automatically.

This allows better handling of default values for attributes - otherwise, if an attribute was set with a default value of "true", then even if it was unchecked, the next time the shortcode was opened to
edit, that default would be applied and the checkbox would be reset to checked.

Fixes #359, #550, and #564. Replaces #413.

Adds the attribute option 'explicitbool' for checkboxes. If a checkbox
is registered with 'explicitbool' => true, then the shortcode will be
formatted with that attribute string like `attribute="false"` if
unchecked. If the shortcode attributes are retrieved using the shortcode
tag as the third parameter to `shortcode_atts()`, then this value will
be converted back to a boolean automatically.

This allows better handling of default values for attributes -
otherwise, if an attribute was set with a default value of "true", then
even if it was unchecked, the next time the shortcode was opened to
edit, that default would be applied and the checkbox would be reset to
checked.
@goldenapples
Copy link
Contributor Author

Would love to get a review for this, if anyone has the time.

@goldenapples goldenapples added this to the next milestone Mar 16, 2017
@goldenapples goldenapples modified the milestone: v0.7.2 Apr 26, 2017
@montchr
Copy link

montchr commented Aug 17, 2018

I'd love to see this merged – #359 is still bugging me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants