54 lines
2.3 KiB
PHP
54 lines
2.3 KiB
PHP
<?php
|
|
/**
|
|
* C-15 incidents view (highlighted).
|
|
*
|
|
* @package Fontdelbosc_Transit
|
|
*
|
|
* @var array<string, mixed> $fontdelbosc_data Template data.
|
|
*/
|
|
|
|
defined( 'ABSPATH' ) || exit;
|
|
|
|
$fontdelbosc_incidents = $fontdelbosc_data['incidents'] ?? array();
|
|
$fontdelbosc_meta = $fontdelbosc_data['meta'] ?? array();
|
|
$fontdelbosc_unavailable = ! empty( $fontdelbosc_data['unavailable'] );
|
|
$fontdelbosc_scope = Fontdelbosc_Transit_Payload::str( $fontdelbosc_data['comarca_label'] ?? null ) ?? '';
|
|
?>
|
|
<section class="fdbt fdbt--c15">
|
|
<h2 class="fdbt__title">
|
|
<?php esc_html_e( 'Traffic on C-15', 'fontdelbosc-transit' ); ?>
|
|
<?php if ( '' !== $fontdelbosc_scope ) : ?>
|
|
<span class="fdbt__scope">— <?php echo esc_html( $fontdelbosc_scope ); ?></span>
|
|
<?php endif; ?>
|
|
<?php if ( ! $fontdelbosc_unavailable && array() !== $fontdelbosc_incidents ) : ?>
|
|
<span class="fdbt-count">
|
|
<?php
|
|
/* translators: %s: number of incidents. */
|
|
echo esc_html( '(' . sprintf( _n( '%s incident', '%s incidents', count( $fontdelbosc_incidents ), 'fontdelbosc-transit' ), number_format_i18n( count( $fontdelbosc_incidents ) ) ) ) . ')';
|
|
?>
|
|
</span>
|
|
<?php endif; ?>
|
|
</h2>
|
|
|
|
<?php if ( $fontdelbosc_unavailable ) : ?>
|
|
<p class="fdbt__empty fdbt__empty--unavailable">
|
|
<span class="fdbt-empty__icon fdbt-empty__icon--muted" aria-hidden="true"><?php echo Fontdelbosc_Transit_Shortcode::icon( 'info' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- trusted static SVG markup. ?></span>
|
|
<?php esc_html_e( 'Data unavailable.', 'fontdelbosc-transit' ); ?>
|
|
</p>
|
|
<?php elseif ( array() === $fontdelbosc_incidents ) : ?>
|
|
<p class="fdbt__empty">
|
|
<span class="fdbt-empty__icon fdbt-empty__icon--ok" aria-hidden="true"><?php echo Fontdelbosc_Transit_Shortcode::icon( 'check' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- trusted static SVG markup. ?></span>
|
|
<?php esc_html_e( 'No incidents on C-15.', 'fontdelbosc-transit' ); ?>
|
|
</p>
|
|
<?php else : ?>
|
|
<div class="fdbt-grid">
|
|
<?php
|
|
foreach ( $fontdelbosc_incidents as $fontdelbosc_incident ) {
|
|
include FONTDELBOSC_TRANSIT_DIR . 'templates/incident-card.php';
|
|
}
|
|
?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php include FONTDELBOSC_TRANSIT_DIR . 'templates/source-footer.php'; ?>
|
|
</section>
|