Tribe__Template::get( array|string $index, mixed $default = null, boolean $is_local = true )
Sets an Index inside of the global or local context.
Final to prevent extending the class when the get
already exists on the child class.
See also
Parameters
- $index
-
(array|string) (Required) Specify each nested index in order. Example: [ 'lvl1', 'lvl2' ];
- $default
-
(mixed) (Optional) Default value if the search finds nothing.
Default value: null
- $is_local
-
(boolean) (Optional) Use the Local or Global context.
Default value: true
Return
(mixed) The value of the specified index or the default if not found.
Source
File: src/Tribe/Template.php
final public function get( $index, $default = null, $is_local = true ) { $context = $this->global; if ( true === $is_local ) { $context = $this->context; } /** * Allows filtering the the getting of Context variables, also short circuiting * Following the same strucuture as WP Core * * @since 4.6.2 * * @param mixed $value The value that will be filtered * @param array $index Specify each nested index in order. * Example: array( 'lvl1', 'lvl2' ); * @param mixed $default Default value if the search finds nothing. * @param boolean $is_local Use the Local or Global context * @param self $template Current instance of the Tribe__Template */ $value = apply_filters( 'tribe_template_context_get', null, $index, $default, $is_local, $this ); if ( null !== $value ) { return $value; } return Tribe__Utils__Array::get( $context, $index, $default ); }
Changelog
Version | Description |
---|---|
4.6.2 | Introduced. |