Skip to content

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
@astratagem
Copy link

astratagem 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.

3 participants