return;
}
if ( ! $handler->use_subscribe_links() && empty( $ical->display_link ) ) {
return;
}
// Users can turn off the link list via a filter, handle that.
if ( ! $handler->use_subscribe_links() ) {
$this->template( 'components/subscribe-links/legacy', [ 'ical' => $ical ] );
return;
}
$view = $this->get_view();
$count = array_filter(
$subscribe_links,
static function( Link_Abstract $link_obj ) use ( $view ) {
return $link_obj->is_visible( $view );
}
);
if ( 1 === count( $count ) ) {
// If we only have one link in the list, show a "button".
$key = array_keys( $count )[0];
$this->template( 'components/subscribe-links/single', [ 'item' => $subscribe_links[ $key ] ] );
} else {
// If we have multiple links in the list, show a "dropdown".
$this->template( 'components/subscribe-links/list', [ 'items' => $subscribe_links ] );
}