Tribe__Template::merge_context( array $context = array(), string $file = null, array $name = null )

Merges local and global context, and saves it locally.



(array) (Optional) Local Context array of data.

Default value: array()


(string) (Optional) Complete path to include the PHP File.

Default value: null


(array) (Optional) Template name.

Default value: null

Top ↑



Top ↑


File: src/Tribe/Template.php

	public function merge_context( $context = array(), $file = null, $name = null ) {
		// Allow for simple null usage as well as array() for nothing
		if ( is_null( $context ) ) {
			$context = array();

		// Applies local context on top of Global one
		$context = wp_parse_args( (array) $context, $this->global );

		 * Allows filtering the Local context
		 * @since  4.6.2
		 * @param array  $context   Local Context array of data
		 * @param string $file      Complete path to include the PHP File
		 * @param array  $name      Template name
		 * @param self   $template  Current instance of the Tribe__Template
		$this->context = apply_filters( 'tribe_template_context', $context, $file, $name, $this );

		return $this->context;

Top ↑


Version Description
4.6.2 Introduced.