View::get_link_label( string $url )

Builds the link label to use from the URL.

This is usually used to build the next and prev link URLs labels. Extending classes can customize the format of the the label by overriding the get_label_format method.

See also


Top ↑

Parameters

$url

(string) (Required) The input URL to build the link label from.


Top ↑

Return

(string) The formatted and localized, but not HTML escaped, link label.


Top ↑

Source

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

	public function get_link_label( $url ) {
		if ( empty( $url ) ) {
			return '';
		}

		$url_query = parse_url( $url, PHP_URL_QUERY );

		if ( empty( $url_query ) ) {
			return '';
		}

		parse_str( $url_query, $args );

		$date = Arr::get_first_set( $args, [ 'eventDate', 'tribe-bar-date' ], false );

		if ( false === $date ) {
			return '';
		}

		$date_object = Dates::build_date_object( $date );

		$format = $this->get_label_format();

		/**
		 * Filters the `date` format that will be used to produce a View link label.
		 *
		 * @since 4.9.9
		 *
		 * @param string    $format    The label format the View will use to product a View link label; e.g. the
		 *                             previous and next links.
		 * @param \DateTime $date      The date object that is being used to build the label.
		 * @param View      $view      This View instance.
		 */
		$format = apply_filters( "tribe_events_views_v2_{$this->slug}_link_label_format", $format, $this, $date );

		return date_i18n( $format, $date_object->getTimestamp() + $date_object->getOffset() );
	}

Top ↑

Changelog

Changelog
Version Description
4.9.9 Introduced.