WP_Widget_Custom_HTML::_register_one() public WP 4.9.0
Add hooks for enqueueing assets when registering all widget instances of this widget class.
{} Это метод класса: WP_Widget_Custom_HTML{}
Хуков нет.
Возвращает
Null. Ничего.
Использование
$WP_Widget_Custom_HTML = new WP_Widget_Custom_HTML(); $WP_Widget_Custom_HTML->_register_one( $number );
- $number(число)
- The unique order number of this widget instance compared to other instances of the same class.
По умолчанию: -1
Список изменений
С версии 4.9.0 | Введена. |
Код WP_Widget_Custom_HTML::_register_one() WP Widget Custom HTML:: register one WP 5.6
public function _register_one( $number = -1 ) {
parent::_register_one( $number );
if ( $this->registered ) {
return;
}
$this->registered = true;
wp_add_inline_script( 'custom-html-widgets', sprintf( 'wp.customHtmlWidgets.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( 'WP_Widget_Custom_HTML', 'render_control_template_scripts' ) );
// Note this action is used to ensure the help text is added to the end.
add_action( 'admin_head-widgets.php', array( 'WP_Widget_Custom_HTML', 'add_help_text' ) );
}