mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Widgets: Fix extensibility of Text widgets so that JS logic will initialize on subclassed widgets.
Amends [40631]. See #35243. Fixes #41540. git-svn-id: https://develop.svn.wordpress.org/trunk@41245 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -55,11 +55,13 @@ class WP_Widget_Text extends WP_Widget {
|
||||
}
|
||||
$this->registered = true;
|
||||
|
||||
wp_add_inline_script( 'text-widgets', sprintf( 'wp.textWidgets.idBases.push( %s );', wp_json_encode( $this->id_base ) ) );
|
||||
|
||||
// Note that the widgets component in the customizer will also do the 'admin_print_scripts-widgets.php' action in WP_Customize_Widgets::print_scripts().
|
||||
add_action( 'admin_print_scripts-widgets.php', array( $this, 'enqueue_admin_scripts' ) );
|
||||
|
||||
// Note that the widgets component in the customizer will also do the 'admin_footer-widgets.php' action in WP_Customize_Widgets::print_footer_scripts().
|
||||
add_action( 'admin_footer-widgets.php', array( $this, 'render_control_template_scripts' ) );
|
||||
add_action( 'admin_footer-widgets.php', array( 'WP_Widget_Text', 'render_control_template_scripts' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -376,8 +378,9 @@ class WP_Widget_Text extends WP_Widget {
|
||||
* Render form template scripts.
|
||||
*
|
||||
* @since 4.8.0
|
||||
* @since 4.9.0 The method is now static.
|
||||
*/
|
||||
public function render_control_template_scripts() {
|
||||
public static function render_control_template_scripts() {
|
||||
$dismissed_pointers = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
|
||||
?>
|
||||
<script type="text/html" id="tmpl-widget-text-control-fields">
|
||||
|
||||
Reference in New Issue
Block a user