Single_Events::single_event_links( string $calendar_links, $subscribe_links )
Replace (overwrite) the default single event links with subscription links.
Contents
See also
Parameters
- $calendar_links
-
(string) (Required) The link content.
Return
(string) The altered link content.
Source
File: src/Tribe/Views/V2/iCalendar/Single_Events.php
public function single_event_links( $calendar_links, $subscribe_links ) {
// Clear links.
$calendar_links = '';
/**
* Allows each link type to add itself to the links on the Event Single views.
*
* @since 5.12.0
* @deprecated 5.16.0 - Single events use the Subscribe Dropdown.
*
* @param array<string|string> $subscribe_links The array of link objects.
* @param View|null $view The current View implementation.
*/
apply_filters_deprecated( 'tec_views_v2_single_subscribe_links', [ [], null ], '5.16.0', '', 'Single event subscribe links use the subscribe dropdown, there is no replacement for this filter.' );
if ( 1 === count( $subscribe_links ) ) {
// If we only have one link in the list, show a "button".
$item = array_shift( $subscribe_links );
$calendar_links .= $this->template->template( 'components/subscribe-links/single', [ 'item' => $item ], false );
} else {
// If we have multiple links in the list, show a "dropdown".
$calendar_links .= $this->template->template( 'components/subscribe-links/single-event-list', [ 'items' => $subscribe_links ], false );
}
return $calendar_links;
}
Changelog
| Version | Description |
|---|---|
| 5.16.0 | Introduced. |