Inventory_Presser_Options::callback_sort_vehicles_by()

callback_sort_vehicles_by


Description Description

Output the controls that create the default vehicle sort setting.


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/class-dealership-options.php

	function callback_sort_vehicles_by()
	{
		//use these default values if we have none
		if( ! isset( $this->option['sort_vehicles_by'] ) )
		{
			$this->option['sort_vehicles_by'] = 'make';
		}
		if( ! isset( $this->option['sort_vehicles_order'] ) )
		{
			$this->option['sort_vehicles_order'] = 'ASC';
		}

		$select = $this->html_select_vehicle_keys( array(
			'name' => INVP::OPTION_NAME . '[sort_vehicles_by]',
			'id'   => 'sort_vehicles_by',
		), $this->option['sort_vehicles_by'] );

		printf(
			'%s %s <select name="%s[sort_vehicles_order]" id="sort_vehicles_order">',
			$select,
			__( 'in', 'inventory-presser' ),
			INVP::OPTION_NAME
		);

		foreach( array( 'ascending' => 'ASC', 'descending' => 'DESC' ) as $direction => $abbr )
		{
			echo '<option value="'. $abbr . '"';
			if( isset( $this->option['sort_vehicles_order'] ) )
			{
				selected( $this->option['sort_vehicles_order'], $abbr );
			}
			echo '>' . $direction . '</option>';
		}
		echo '</select> ' . __( 'order', 'inventory-presser' );
	}