Widget_Month::filter_mobile_events( string $html, string $file, array $name, Tribe__Template $template )
Replaces the mobile events list with our own for the widget.
Contents
Parameters
- $html
-
(string) (Required) The final HTML.
- $file
-
(string) (Required) Complete path to include the PHP File.
- $name
-
(array) (Required) Template name.
- $template
-
(Tribe__Template) (Required) Current instance of the Tribe__Template.
Return
(string) $html The final HTML.
Source
File: src/Tribe/Views/V2/Widgets/Widget_Month.php
public function filter_mobile_events( $html, $file, $name, $template ) {
$today = Dates::build_date_object( $template->get( 'url_event_date', $template->get( 'today', 'today' ) ) );
$formatted_today = $today->format('Y-m-d');
$days = $template->get( 'days', [] );
$the_day_events = $days[ $formatted_today ][ 'events' ];
$events_per_day = absint( $this->get_argument( 'count' ) );
if( $events_per_day <= count( $the_day_events ) ) {
return $html;
}
$the_day_events = $this->the_day_events( $template, $events_per_day, $the_day_events );
$days[ $formatted_today ]['events'] = $the_day_events;
$days[ $formatted_today ]['found_events'] = count($the_day_events);
$template->set( 'days', $days );
return $html;
}
Changelog
| Version | Description |
|---|---|
| 5.5.0 | Introduced. |