Skip to content

Commit 8c3f52d

Browse files
authored
Merge pull request #43 from a8cteam51/fix/show-editor-message-if-all-dates-passed
Show the event passed message if not events and not rendered output
2 parents 020ca32 + 6b6a097 commit 8c3f52d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/classes/class-se-blocks.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ public static function event_info_render( $attributes, $content, $block ) {
262262
$date_display_formatter->modify_timezone( $event_timezone );
263263
}
264264

265+
$date_count = 0;
266+
265267
// If we are hiding past dates.
266268
$options = get_option( 'se_options' );
267269
$event_options = array( 'hide_events_on_both', 'hide_events_on_feed', 'on' );
@@ -273,6 +275,7 @@ public static function event_info_render( $attributes, $content, $block ) {
273275
}
274276

275277
$now = se_create_date_time_from_timestamp( time(), $ts )->getTimestamp();
278+
276279
// Remove any dates that have passed.
277280
$event_dates = array_filter(
278281
$event_dates,
@@ -367,6 +370,16 @@ public static function event_info_render( $attributes, $content, $block ) {
367370
$output .= se_template_calendar_links( false );
368371
}
369372

373+
// Maybe show the event passes message.
374+
if ( 0 === count( $event_dates ) && '' === $output ) {
375+
$options = get_option( 'se_options' );
376+
if ( isset( $options['past_event_notice'] ) && ! empty( $options['past_event_notice'] ) ) {
377+
$output .= '<div class="wp-block-se-event-info">';
378+
$output .= '<p class="se-event-past-notice">' . esc_html( $options['past_event_notice'] ) . '</p>';
379+
$output .= '</div>';
380+
}
381+
}
382+
370383
return apply_filters( 'simple_events_event_info_render', $output, $event_dates, $event_timezone, $event_location, $attributes );
371384
}
372385

0 commit comments

Comments
 (0)