Inventory_Presser_Grid::widget( array $args, array $instance )

Outputs the widget front-end HTML


Parameters Parameters

$args

(array) (Required)

$instance

(array) (Required)


Top ↑

Return Return

(void)


Top ↑

Source Source

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

	public function widget( $args, $instance ) {

		// build $args array.
		$content_args = array();
		if ( isset( $instance['columns'] ) ) {
			$content_args['columns'] = $instance['columns'];
		}
		if ( isset( $instance['limit'] ) ) {
			$content_args['limit'] = $instance['limit'];
		}
		if ( isset( $instance['cb_showcaptions'] ) ) {
			$content_args['show_captions'] = ( 'true' === $instance['cb_showcaptions'] );
		}
		if ( isset( $instance['cb_showbutton'] ) ) {
			$content_args['show_button'] = ( 'true' === $instance['cb_showbutton'] );
		}
		if ( isset( $instance['cb_showprices'] ) ) {
			$content_args['show_prices'] = ( 'true' === $instance['cb_showprices'] );
		}
		if ( isset( $instance['newest_first'] ) ) {
			$content_args['newest_first'] = filter_var( $instance['newest_first'], FILTER_VALIDATE_BOOLEAN );
		}

		// before and after widget arguments are defined by themes.
		echo $args['before_widget'];
		$title = apply_filters( 'widget_title', $instance['title'] ?? '' );
		if ( ! empty( $title ) ) {
			echo $args['before_title'] . $title . $args['after_title'];
		}

		echo $this->content( $content_args ) . $args['after_widget'];
	}