WP_Widget_Text::render_control_template_scripts() WordPress Method
The WP_Widget_Text::render_control_template_scripts() method is used to render the template scripts for the widget control. This method is called in the admin_print_scripts-widgets.php file.
WP_Widget_Text::render_control_template_scripts() #
Render form template scripts.
Source
File: wp-includes/widgets/class-wp-widget-text.php
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"> <# var elementIdPrefix = 'el' + String( Math.random() ).replace( /\D/g, '' ) + '_' #> <p> <label for="{{ elementIdPrefix }}title"><?php esc_html_e( 'Title:' ); ?></label> <input id="{{ elementIdPrefix }}title" type="text" class="widefat title"> </p> <?php if ( ! in_array( 'text_widget_custom_html', $dismissed_pointers, true ) ) : ?> <div hidden class="wp-pointer custom-html-widget-pointer wp-pointer-top"> <div class="wp-pointer-content"> <h3><?php _e( 'New Custom HTML Widget' ); ?></h3> <?php if ( is_customize_preview() ) : ?> <p><?php _e( 'Did you know there is a “Custom HTML” widget now? You can find it by pressing the “<a class="add-widget" href="#">Add a Widget</a>” button and searching for “HTML”. Check it out to add some custom code to your site!' ); ?></p> <?php else : ?> <p><?php _e( 'Did you know there is a “Custom HTML” widget now? You can find it by scanning the list of available widgets on this screen. Check it out to add some custom code to your site!' ); ?></p> <?php endif; ?> <div class="wp-pointer-buttons"> <a class="close" href="#"><?php _e( 'Dismiss' ); ?></a> </div> </div> <div class="wp-pointer-arrow"> <div class="wp-pointer-arrow-inner"></div> </div> </div> <?php endif; ?> <?php if ( ! in_array( 'text_widget_paste_html', $dismissed_pointers, true ) ) : ?> <div hidden class="wp-pointer paste-html-pointer wp-pointer-top"> <div class="wp-pointer-content"> <h3><?php _e( 'Did you just paste HTML?' ); ?></h3> <p><?php _e( 'Hey there, looks like you just pasted HTML into the “Visual” tab of the Text widget. You may want to paste your code into the “Text” tab instead. Alternately, try out the new “Custom HTML” widget!' ); ?></p> <div class="wp-pointer-buttons"> <a class="close" href="#"><?php _e( 'Dismiss' ); ?></a> </div> </div> <div class="wp-pointer-arrow"> <div class="wp-pointer-arrow-inner"></div> </div> </div> <?php endif; ?> <p> <label for="{{ elementIdPrefix }}text" class="screen-reader-text"><?php esc_html_e( 'Content:' ); ?></label> <textarea id="{{ elementIdPrefix }}text" class="widefat text wp-editor-area" style="height: 200px" rows="16" cols="20"></textarea> </p> </script> <?php }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
4.9.0 | The method is now static. |
4.8.0 | Introduced. |