Provider::filter_context_locations( TECFilter_BarCustom_TablesV1array $locations = array() )

Filters the Context locations to add the one that will allow looking up the current Series Filter values.


Parameters

$locations

(<span class="TECFilter_BarCustom_TablesV1array">TECFilter_BarCustom_TablesV1array) (Optional) A map of the current Context locations.

Default value: array()


Top ↑

Return

(TECFilter_BarCustom_TablesV1array<string,array>) A filtered map of Context locations.


Top ↑

Source

File: src/Filter_Bar/Custom_Tables/V1/Provider.php

	public function filter_context_locations( array $locations = [] ) {
		$parse_data_from_url = static function ( $view_data ) {
			if ( ! isset( $view_data['url'] ) ) {
				return Context::NOT_FOUND;
			}

			wp_parse_str(
				(string) wp_parse_url( $view_data['url'], PHP_URL_QUERY ),
				$parsed
			);

			return isset( $parsed['tribe_filterbar_series_id'] ) ?
				Arr::list_to_array( $parsed['tribe_filterbar_series_id'] )
				: Context::NOT_FOUND;
		};

		$locations = array_merge( $locations,
			[
				'filterbar_series_id' => [
					'read' => [
						Context::QUERY_VAR     => [ 'tribe_series_id' ],
						Context::REQUEST_VAR   => [ 'tribe_series_id' ],
						Context::LOCATION_FUNC => [ 'view_data', $parse_data_from_url ],
					],
				]
			]
		);

		return $locations;
	}

Top ↑

Changelog

Changelog
Version Description
5.4.0 Introduced.