Tribe__Events__Repositories__Event::filter_by_on_calendar_grid( int $month, int $year )

Filters events to include only those events that appear on the given month’s calendar grid.


Parameters

$month

(int) (Required) The month to display.

$year

(int) (Required) The year to display.


Top ↑

Return

(array|null) An array of arguments that should be added to the query or null if the arguments are not valid (thus the filter will be ignored).


Top ↑

Source

File: src/Tribe/Repositories/Event.php

	public function filter_by_on_calendar_grid( $month, $year ) {
		$year_month_string = "{$year}-{$month}";

		if ( ! Tribe__Date_Utils::is_valid_date( $year_month_string ) ) {
			/*
			 * Months and years are known but, at runtime, the client code might get, or pass,
			 * them wrong. In that case this filter will not be applied.
			 */
			return null;
		}

		$start = Tribe__Events__Template__Month::calculate_first_cell_date( $year_month_string );
		$end   = Tribe__Events__Template__Month::calculate_final_cell_date( $year_month_string );

		return $this->filter_by_runs_between( $start, tribe_end_of_day( $end ) );
	}

Top ↑

Changelog

Changelog
Version Description
4.9 Introduced.