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: http://svn.automattic.com/wordpress/trunk@20302 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
koopersmith 2012-03-28 09:45:51 +00:00
parent fc22367830
commit 89d5c6dc7a
1 changed files with 21 additions and 13 deletions

View File

@ -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':
$dropdown = wp_dropdown_pages(
array(
'name' => '_customize-dropdown-pages-' . $this->id,
'echo' => 0,
'show_option_none' => __( '&mdash; Select &mdash;' ),
'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,
wp_dropdown_pages(
array(
// @todo: this is going to need fixing.
// 'name' => $this->get_name(),
'echo' => 0,
'show_option_none' => __( '&mdash; Select &mdash;' ),
'option_none_value' => '0',
'selected' => $this->value(),
)
)
$dropdown
);
break;
}