Inventory_Presser_Order_By_Widget::__construct()

__construct


Description

Calls the parent class' contructor and adds a hook that will delete the option that stores this widget's data when the plugin's delete all data method is run.


Return

(void)


Source

File: includes/widget/class-widget-order-by.php

	public function __construct() {
		parent::__construct(
			self::ID_BASE, // Base ID
			__( 'Sort by Vehicle Attributes', 'inventory-presser' ), // Name
			array(
				'description'           => __( 'A list of vehicle attributes by which users can sort listings.', 'inventory-presser' ),
				'show_instance_in_rest' => true,
			) // Args
		);

		// include scripts if widget is used
		if ( is_active_widget( false, false, self::ID_BASE ) ) {
			add_action( 'wp_enqueue_scripts', array( $this, 'load_javascript' ) );
		}

		add_action( 'invp_delete_all_data', array( $this, 'delete_option' ) );
	}