From 89d5c6dc7aa7f15183f89b3a394bc8394f0cc430 Mon Sep 17 00:00:00 2001 From: koopersmith Date: Wed, 28 Mar 2012 09:45:51 +0000 Subject: [PATCH] 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 --- wp-includes/class-wp-customize-control.php | 34 +++++++++++++--------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/wp-includes/class-wp-customize-control.php b/wp-includes/class-wp-customize-control.php index 32d76658df..a5bd9daa5a 100644 --- a/wp-includes/class-wp-customize-control.php +++ b/wp-includes/class-wp-customize-control.php @@ -168,11 +168,15 @@ class WP_Customize_Control { 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 { '_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( 'get_link(), $dropdown ); + printf( '', $this->label, - wp_dropdown_pages( - array( - // @todo: this is going to need fixing. - // 'name' => $this->get_name(), - 'echo' => 0, - 'show_option_none' => __( '— Select —' ), - 'option_none_value' => '0', - 'selected' => $this->value(), - ) - ) + $dropdown ); break; }