Opened 10 years ago
Last modified 8 years ago
#29948 new enhancement
Use contextual controls (active_callback) API for conditionally-displayed core contextual controls
Reported by: | celloexpressions | Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | lowest |
Severity: | normal | Version: | 4.0 |
Component: | Customize | Keywords: | needs-patch |
Focuses: | Cc: |
Description
See wp-admin/js/customize-controls.js
, near the bottom. Rather than doing some unstructured JS to show/hide controls based on the values of other settings, this should use custom callbacks for the active_callback argument when adding the control (in php).
Change History (11)
#2
@
10 years ago
Yes, although I didn't look at it particularly closely. Maybe it makes more sense to keep it separate, but it seemed like it would be better to move it (and also to make those controls less tightly coupled with core, so that they can be understood as examples for themes and plugins).
#3
@
10 years ago
That being said, it wouldn't be instant based on the current methods, so maybe that isn't the best approach. We may need an improved API for conditional controls that is all-js, but doesn't require as much custom code for individual controls implementing it themselves.
This ticket was mentioned in Slack in #core-customize by valendesigns. View the logs.
10 years ago
#6
@
10 years ago
I like this idea, though we need to discuss implementation when time permits and before a patch is started.
This ticket was mentioned in Slack in #core by celloexpressions. View the logs.
9 years ago
#8
@
9 years ago
Adding the chat note by @ celloexpressions in Slack https://wordpress.slack.com/archives/core/p1440004003001718
"#33420, #33428 and #33434 are all duplicates. Testing, looks like the code that toggles those is conflicting with their active states. Best solution is probably to do #29948, but we likely need to figure something else out for 4.3.1. Looks like changing static front page also re-calculates the top position of the section (incorrectly),”
#9
@
8 years ago
A writeup to assist with this: https://make.xwp.co/2016/07/24/dependently-contextual-customizer-controls/
You're referring to this code?