Inventory_Presser_Classic_Editor::scripts_and_styles( string $hook )

Includes JavaScripts and stylesheets that power our changes to the dashboard.


Parameters Parameters

$hook

(string) (Required)


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/integrations/class-classic-editor.php

	public function scripts_and_styles( $hook ) {
		$handle = 'invp-classic-editor';
		if ( ! wp_script_is( $handle, 'registered' ) ) {
			Inventory_Presser_Plugin::include_scripts_and_styles();
		}
		$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
		wp_enqueue_style(
			$handle,
			plugins_url( "/css/classic-editor{$min}.css", INVP_PLUGIN_FILE_PATH ),
			array(),
			INVP_PLUGIN_VERSION
		);
		wp_enqueue_script( $handle );

		// Provide data to JavaScript for the editor.
		wp_add_inline_script(
			$handle,
			'const invp_classic_editor = ' . wp_json_encode(
				array(
					'delete_all_media_nonce' => wp_create_nonce( self::NONCE_DELETE_ALL_MEDIA ),
				)
			),
			'before'
		);
	}