mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 06:57:35 +01:00
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:
parent
fc22367830
commit
89d5c6dc7a
@ -168,11 +168,15 @@ class WP_Customize_Control {
|
|||||||
</li><?php
|
</li><?php
|
||||||
}
|
}
|
||||||
|
|
||||||
public function link( $setting_key = 'default' ) {
|
public function get_link( $setting_key = 'default' ) {
|
||||||
if ( ! isset( $this->settings[ $setting_key ] ) )
|
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
|
<?php
|
||||||
break;
|
break;
|
||||||
case 'dropdown-pages':
|
case 'dropdown-pages':
|
||||||
|
$dropdown = wp_dropdown_pages(
|
||||||
|
array(
|
||||||
|
'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(
|
printf(
|
||||||
'<label class="customize-control-select"><span class="customize-control-title">%s</span> %s</label>',
|
'<label class="customize-control-select"><span class="customize-control-title">%s</span> %s</label>',
|
||||||
$this->label,
|
$this->label,
|
||||||
wp_dropdown_pages(
|
$dropdown
|
||||||
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(),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user