WordPress at Your Fingertips
function is not described

ActionScheduler_Abstract_ListTable::display_filter_by_status() protected WC 1.0

Prints the available statuses so the user can click to filter.

{} It's a method of the class: ActionScheduler_Abstract_ListTable{}

No Hooks.

Return

null. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->display_filter_by_status();

Code of ActionScheduler_Abstract_ListTable::display_filter_by_status() WC 6.1.1

protected function display_filter_by_status() {

	$status_list_items = array();
	$request_status    = $this->get_request_status();

	// Helper to set 'all' filter when not set on status counts passed in.
	if ( ! isset( $this->status_counts['all'] ) ) {
		$this->status_counts = array( 'all' => array_sum( $this->status_counts ) ) + $this->status_counts;
	}

	foreach ( $this->status_counts as $status_name => $count ) {

		if ( 0 === $count ) {
			continue;
		}

		if ( $status_name === $request_status || ( empty( $request_status ) && 'all' === $status_name ) ) {
			$status_list_item = '<li class="%1$s"><strong>%3$s</strong> (%4$d)</li>';
		} else {
			$status_list_item = '<li class="%1$s"><a href="%2$s">%3$s</a> (%4$d)</li>';
		}

		$status_filter_url   = ( 'all' === $status_name ) ? remove_query_arg( 'status' ) : add_query_arg( 'status', $status_name );
		$status_filter_url   = remove_query_arg( array( 'paged', 's' ), $status_filter_url );
		$status_list_items[] = sprintf( $status_list_item, esc_attr( $status_name ), esc_url( $status_filter_url ), esc_html( ucfirst( $status_name ) ), absint( $count ) );
	}

	if ( $status_list_items ) {
		echo '<ul class="subsubsub">';
		echo implode( " | \n", $status_list_items ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
		echo '</ul>';
	}
}