Inventory_Presser_Grid::form( array $instance )
Outputs the widget settings form that is shown in the dashboard.
On This Page
Parameters Parameters
- $instance
-
(array) (Required) The widget settings.
Return Return
(void)
Source Source
File: includes/widget/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 esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'inventory-presser' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'columns' ) ); ?>"><?php esc_html_e( 'Column count:', 'inventory-presser' ); ?></label>
<select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'columns' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'columns' ) ); ?>">
<?php echo $this->get_column_options_html( $columns ); ?>
</select>
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php esc_html_e( 'Maximum:', 'inventory-presser' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>" type="number" value="<?php echo esc_attr( $limit ); ?>" />
</p>
<p>
<input type="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'cb_showcaptions' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'cb_showcaptions' ) ); ?>" value="true"<?php checked( 'true', isset( $instance['cb_showcaptions'] ) ? $instance['cb_showcaptions'] : '', true ); ?>>
<label for="<?php echo esc_attr( $this->get_field_id( 'cb_showcaptions' ) ); ?>"><?php esc_html_e( 'Show captions', 'inventory-presser' ); ?></label>
<br />
<input type="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'cb_showprices' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'cb_showprices' ) ); ?>" value="true"<?php checked( 'true', isset( $instance['cb_showprices'] ) ? $instance['cb_showprices'] : '', true ); ?>>
<label for="<?php echo esc_attr( $this->get_field_id( 'cb_showprices' ) ); ?>"><?php esc_html_e( 'Show prices', 'inventory-presser' ); ?></label>
<br />
<input type="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'cb_showbutton' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'cb_showbutton' ) ); ?>" value="true"<?php checked( 'true', isset( $instance['cb_showbutton'] ) ? $instance['cb_showbutton'] : '', true ); ?>>
<label for="<?php echo esc_attr( $this->get_field_id( 'cb_showbutton' ) ); ?>"><?php esc_html_e( 'Show "Full Inventory" button', 'inventory-presser' ); ?></label>
<br />
<input type="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'cb_featured_only' ) ); ?>" name="<?php echo esc_attr( $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 esc_attr( $this->get_field_id( 'cb_featured_only' ) ); ?>"><?php esc_html_e( 'Featured vehicles only', 'inventory-presser' ); ?></label>
<br />
<input type="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'newest_first' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'newest_first' ) ); ?>" value="true"<?php checked( true, isset( $instance['newest_first'] ) ? $instance['newest_first'] : false, true ); ?>>
<label for="<?php echo esc_attr( $this->get_field_id( 'newest_first' ) ); ?>"><?php esc_html_e( 'Newest vehicles first', 'inventory-presser' ); ?></label>
</p>
<?php
}
Expand full source codeCollapse full source codeView on Github