wppaste
WordPress

WP_Widget_Custom_HTML::enqueue_admin_scripts()

Since
4.9.0
Source
wp-includes/widgets/class-wp-widget-custom-html.php:206
Loads the required scripts and styles for the widget control.

Uses · 5

Source

	public function enqueue_admin_scripts() {		$settings = wp_enqueue_code_editor(			array(				'type'       => 'text/html',				'codemirror' => array(					'indentUnit' => 2,					'tabSize'    => 2,				),			)		); 		wp_enqueue_script( 'custom-html-widgets' );		wp_add_inline_script( 'custom-html-widgets', sprintf( 'wp.customHtmlWidgets.idBases.push( %s );', wp_json_encode( $this->id_base, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ) ); 		if ( empty( $settings ) ) {			$settings = array(				'disabled' => true,			);		}		wp_add_inline_script( 'custom-html-widgets', sprintf( 'wp.customHtmlWidgets.init( %s );', wp_json_encode( $settings, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ), 'after' ); 		$l10n = array(			'errorNotice' => array(				/* translators: %d: Error count. */				'singular' => _n( 'There is %d error which must be fixed before you can save.', 'There are %d errors which must be fixed before you can save.', 1 ),				/* translators: %d: Error count. */				'plural'   => _n( 'There is %d error which must be fixed before you can save.', 'There are %d errors which must be fixed before you can save.', 2 ),				// @todo This is lacking, as some languages have a dedicated dual form. For proper handling of plurals in JS, see #20491.			),		);		wp_add_inline_script( 'custom-html-widgets', sprintf( 'jQuery.extend( wp.customHtmlWidgets.l10n, %s );', wp_json_encode( $l10n, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ), 'after' );	}

History

Introduced in 4.9.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.9.7 tag, from src/wp-includes/widgets/class-wp-widget-custom-html.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.