View::get_title( array $events = array() )
Gets this View title, the one that will be set in the title tag of the page.
Contents
Parameters
- $events
-
(array) (Optional) An array of events to generate the title for.
Default value: array()
Return
(string) The filtered view title.
Source
File: src/Tribe/Views/V2/View.php
public function get_title( array $events = [] ) {
if ( ! $this->context->doing_php_initial_state() ) {
/** @var Title $title_filter */
$title_filter = static::$container->make( Title::class )
->set_context( $this->context )
->set_posts( $events );
add_filter( 'document_title_parts', [ $title_filter, 'filter_document_title_parts' ] );
// We disable the filter to avoid the double encoding that would come from our preparation of the data.
add_filter( 'run_wptexturize', '__return_false' );
}
$title = wp_get_document_title();
if ( isset( $title_filter ) ) {
remove_filter( 'run_wptexturize', '__return_false' );
remove_filter( 'document_title_parts', [ $title_filter, 'filter_document_title_parts' ] );
}
$slug = $this->get_slug();
/**
* Filters the title for all views.
*
* @since 4.9.10
*
* @param string $title This view filtered title.
* @param View $this This view object.
*/
$title = apply_filters( "tribe_events_views_v2_title", $title, $this );
/**
* Filters the title for this view.
*
* @since 4.9.10
*
* @param string $title This view filtered title.
* @param View $this This view object.
*/
$title = apply_filters( "tribe_events_views_v2_{$slug}_title", $title, $this );
return htmlspecialchars_decode($title);
}
Changelog
| Version | Description |
|---|---|
| 4.9.10 | Introduced. |