Theme Customizer: Add data binding to page dropdown controls. Add WP_Customize_Control->get_link() to return the data attribute string. see #19910.
git-svn-id: https://develop.svn.wordpress.org/trunk@20302 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
d5f5376394
commit
21449c3269
|
@ -168,11 +168,15 @@ class WP_Customize_Control {
|
|||
</li><?php
|
||||
}
|
||||
|
||||
public function link( $setting_key = 'default' ) {
|
||||
public function get_link( $setting_key = 'default' ) {
|
||||
if ( ! isset( $this->settings[ $setting_key ] ) )
|
||||
return;
|
||||
return '';
|
||||
|
||||
echo 'data-customize-setting-link="' . esc_attr( $this->settings[ $setting_key ]->id ) . '"';
|
||||
return 'data-customize-setting-link="' . esc_attr( $this->settings[ $setting_key ]->id ) . '"';
|
||||
}
|
||||
|
||||
public function link( $setting_key = 'default' ) {
|
||||
echo $this->get_link( $setting_key );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -309,19 +313,23 @@ class WP_Customize_Control {
|
|||
<?php
|
||||
break;
|
||||
case 'dropdown-pages':
|
||||
printf(
|
||||
'<label class="customize-control-select"><span class="customize-control-title">%s</span> %s</label>',
|
||||
$this->label,
|
||||
wp_dropdown_pages(
|
||||
$dropdown = wp_dropdown_pages(
|
||||
array(
|
||||
// @todo: this is going to need fixing.
|
||||
// 'name' => $this->get_name(),
|
||||
'name' => '_customize-dropdown-pages-' . $this->id,
|
||||
'echo' => 0,
|
||||
'show_option_none' => __( '— Select —' ),
|
||||
'option_none_value' => '0',
|
||||
'selected' => $this->value(),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Hackily add in the data link parameter.
|
||||
$dropdown = str_replace( '<select', '<select ' . $this->get_link(), $dropdown );
|
||||
|
||||
printf(
|
||||
'<label class="customize-control-select"><span class="customize-control-title">%s</span> %s</label>',
|
||||
$this->label,
|
||||
$dropdown
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue