Inventory_Presser_Admin_Location_Meta::scripts_and_styles( string $hook )

Loads stylesheets and JavaScript files on pages that edit terms.


Parameters

$hook

(string) (Required) The file name of the current page.


Return

(void)


Source

File: includes/admin/class-admin-location-meta.php

	public function scripts_and_styles( $hook ) {
		global $current_screen;
		if ( ( 'edit-tags.php' === $hook || 'term.php' === $hook )
			&& INVP::POST_TYPE === $current_screen->post_type
			&& 'location' === $current_screen->taxonomy
		) {
			$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
			wp_enqueue_style(
				'inventory-presser-timepicker-css',
				plugins_url( "/css/jquery.timepicker{$min}.css", INVP_PLUGIN_FILE_PATH ),
				array(),
				INVP_PLUGIN_VERSION
			);
			wp_enqueue_style(
				'invp-location-term',
				plugins_url( "/css/location-term{$min}.css", INVP_PLUGIN_FILE_PATH ),
				array(),
				INVP_PLUGIN_VERSION
			);
			wp_enqueue_script(
				'inventory-presser-timepicker',
				plugins_url( '/js/jquery.timepicker.min.js', INVP_PLUGIN_FILE_PATH ), // Non-minimized version not included.
				array( 'jquery' ),
				INVP_PLUGIN_FILE_PATH,
				true
			);
			wp_enqueue_script( 'jquery-ui-sortable' );
			wp_enqueue_script(
				'inventory-presser-location',
				plugins_url( "/js/tax-location{$min}.js", INVP_PLUGIN_FILE_PATH ),
				array( 'inventory-presser-timepicker', 'jquery-ui-sortable' ),
				INVP_PLUGIN_FILE_PATH,
				true
			);
		}
	}