Month_View::get_multiday_stack( DateTime|string $from, DateTime|string $to )

Returns a portion of the parsed multi-day stacks.


Parameters

$from

(DateTime|string) (Required) The start of the portion to return.

$to

(DateTime|string) (Required) The end of the portion to return.


Top ↑

Return

(array|null) A slice of the multi-day stack, in the shape [ '2019-07-01' => [2, 3, false], , '2019-07-03' => [false, 3, 4]].


Top ↑

Source

File: src/Tribe/Views/V2/Views/Month_View.php

	public function get_multiday_stack( $from, $to ) {
		$from = Dates::build_date_object( $from )->setTime( 0, 0 );
		$to   = Dates::build_date_object( $to )->setTime( 23, 59, 59 );

		$events = $this->get_grid_days();
		$multiday_stack = $this->build_day_stacks( $events );

		$start_index = array_key_exists( $from->format( 'Y-m-d' ), $multiday_stack )
			? array_search( $from->format( 'Y-m-d' ), array_keys( $multiday_stack ), true )
			: 0;
		$end_index   = array_key_exists( $to->format( 'Y-m-d' ), $multiday_stack )
			? array_search( $to->format( 'Y-m-d' ), array_keys( $multiday_stack ), true )
			: count( $multiday_stack ) - 1;

		$stack = array_slice( $multiday_stack, $start_index, $end_index - $start_index + 1, true );

		return $stack;
	}

Top ↑

Changelog

Changelog
Version Description
4.9.7 Introduced.