WP_Widget_Text::_register_one()publicWP 1.0

Adds hooks for enqueueing assets when registering all widget instances of this widget class.

Method of the class: WP_Widget_Text{}

No Hooks.

Return

null. Nothing (null).

Usage

$WP_Widget_Text = new WP_Widget_Text();
$WP_Widget_Text->_register_one( $number );
$number(int)
The unique order number of this widget instance compared to other instances of the same class.
Default: -1

WP_Widget_Text::_register_one() code WP 6.5.2

public function _register_one( $number = -1 ) {
	parent::_register_one( $number );
	if ( $this->registered ) {
		return;
	}
	$this->registered = true;

	if ( $this->is_preview() ) {
		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_preview_scripts' ) );
	}

	/*
	 * 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_Text', 'render_control_template_scripts' ) );
}