Inventory_Presser_Admin_Editor_Sidebar::scripts_and_styles()

Includes the wp-api JavaScript

On This Page


Return Return

(void)


Top ↑

Source Source

File: includes/admin/class-admin-editor-sidebar.php

	public function scripts_and_styles() {
		$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
		wp_enqueue_script( 'wp-api' );
		wp_enqueue_style(
			'invp-editor-sidebar',
			plugins_url( '/css/editor-sidebar.min.css', INVP_PLUGIN_FILE_PATH ),
			array(),
			INVP_PLUGIN_VERSION
		);

		// Provide data to JavaScript for the editor.
		wp_add_inline_script(
			'wp-api',
			'const invp = ' . wp_json_encode(
				array(
					'hull_materials'      => apply_filters(
						'invp_default_hull_materials',
						array(
							__( 'Aluminum', 'inventory-presser' ),
							__( 'Carbon Fiber', 'inventory-presser' ),
							__( 'Composite', 'inventory-presser' ),
							__( 'Ferro-Cement', 'inventory-presser' ),
							__( 'Fiberglass', 'inventory-presser' ),
							__( 'Hypalon', 'inventory-presser' ),
							__( 'Other', 'inventory-presser' ),
							__( 'PVC', 'inventory-presser' ),
							__( 'Steel', 'inventory-presser' ),
							__( 'Wood', 'inventory-presser' ),
						)
					),
					'miles_word'          => apply_filters( 'invp_odometer_word', 'miles' ),
					'meta_prefix'         => INVP::meta_prefix(),
					'payment_frequencies' => apply_filters(
						'invp_default_payment_frequencies',
						array(
							'Monthly'      => 'monthly',
							'Weekly'       => 'weekly',
							'Bi-weekly'    => 'biweekly',
							'Semi-monthly' => 'semimonthly',
						)
					),
					'title_statuses'      => apply_filters(
						'invp_default_title_statuses',
						array(
							'Unspecified',
							'Clear',
							'Clean',
							'Flood, Water Damage',
							'Lemon and Manufacturers Buyback',
							'Rebuild, Rebuildable, and Reconstructed',
							'Salvage',
							'Other',
						)
					),
				)
			),
			'before'
		);
	}