Inventory_Presser_Grid::form( array $instance )

form


Description Description

Outputs the widget settings form that is shown in the dashboard.


Top ↑

Parameters Parameters

$instance

(array) (Required)


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/class-widget-inventory-grid.php

	public function form( $instance ) {

		$title = isset($instance[ 'title' ]) ? $instance[ 'title' ] : '';
		$columns = (isset($instance['columns'])) ? $instance['columns'] : 5;
		$limit = (isset($instance['limit'])) ? $instance['limit'] : $columns * 3;

		// Widget admin form
		?>
		<p>
		<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'inventory-presser' ); ?></label>
		<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
		</p>

		<p>
		<label for="<?php echo $this->get_field_id('columns'); ?>"><?php _e( 'Column count:', 'inventory-presser' ); ?></label>
		<select class="widefat" id="<?php echo $this->get_field_id('columns'); ?>" name="<?php echo $this->get_field_name('columns'); ?>">
		<?php echo $this->get_column_options_html($columns); ?>
		</select>
		</p>
		<p>
		<label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Maximum:', 'inventory-presser' ); ?></label>
		<input class="widefat" id="<?php echo $this->get_field_id('limit'); ?>" name="<?php echo $this->get_field_name('limit'); ?>" type="number" value="<?php echo esc_attr( $limit ); ?>" />
		</p>
		<p>
			<input type="checkbox" id="<?php echo $this->get_field_id('cb_showcaptions'); ?>" name="<?php echo $this->get_field_name('cb_showcaptions'); ?>" value="true"<?php checked( 'true', isset( $instance['cb_showcaptions'] ) ? $instance['cb_showcaptions'] : '', true ); ?>>
			<label for="<?php echo $this->get_field_id('cb_showcaptions'); ?>"><?php _e( 'Show captions', 'inventory-presser' ); ?></label>
			<br />
			<input type="checkbox" id="<?php echo $this->get_field_id('cb_showprices'); ?>" name="<?php echo $this->get_field_name('cb_showprices'); ?>" value="true"<?php checked( 'true', isset( $instance['cb_showprices'] ) ? $instance['cb_showprices'] : '', true ); ?>>
			<label for="<?php echo $this->get_field_id('cb_showprices'); ?>"><?php _e( 'Show prices', 'inventory-presser' ); ?></label>
			<br />
			<input type="checkbox" id="<?php echo $this->get_field_id('cb_showbutton'); ?>" name="<?php echo $this->get_field_name('cb_showbutton'); ?>" value="true"<?php checked( 'true', isset( $instance['cb_showbutton'] ) ? $instance['cb_showbutton'] : '', true ); ?>>
			<label for="<?php echo $this->get_field_id('cb_showbutton'); ?>"><?php _e( 'Show "Full Inventory" button', 'inventory-presser' ); ?></label>
			<br />
			<input type="checkbox" id="<?php echo $this->get_field_id('cb_featured_only'); ?>" name="<?php echo $this->get_field_name('cb_featured_only'); ?>" value="true"<?php checked( 'true', isset( $instance['cb_featured_only'] ) ? $instance['cb_featured_only'] : '', true ); ?>>
			<label for="<?php echo $this->get_field_id('cb_featured_only'); ?>"><?php _e( 'Featured vehicles only', 'inventory-presser' ); ?></label>
			<br />
			<input type="checkbox" id="<?php echo $this->get_field_id( 'newest_first' ); ?>" name="<?php echo $this->get_field_name( 'newest_first' ); ?>" value="true"<?php checked( true, isset( $instance['newest_first'] ) ? $instance['newest_first'] : false, true ); ?>>
			<label for="<?php echo $this->get_field_id( 'newest_first' ); ?>"><?php _e( 'Newest vehicles first', 'inventory-presser' ); ?></label>
		</p>

		<?php
	}