Inventory_Presser_Classic_Editor::scripts_and_styles( string $hook )

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


Parameters

$hook

(string) (Required)


Return

(void)


Source

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

	public function scripts_and_styles( $hook ) {
		$handle = 'invp-classic-editor';
		$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,
			plugins_url( "/js/classic-editor{$min}.js", INVP_PLUGIN_FILE_PATH ),
			array(),
			INVP_PLUGIN_VERSION,
			true
		);

		// 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'
		);
	}