From 21449c3269650f153f1aa2d0c9787ec6886596fd Mon Sep 17 00:00:00 2001 From: Daryl 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: https://develop.svn.wordpress.org/trunk@20302 602fd350-edb4-49c9-b593-d223f7449a82 --- 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; }