Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 19
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2/**
3 * Podcast Title template.
4 *
5 * @html-template Automattic\Jetpack\Extensions\Podcast_Player\render
6 * @package automattic/jetpack
7 */
8
9// phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable -- HTML template, let Phan handle it.
10
11namespace Automattic\Jetpack\Extensions\Podcast_Player;
12
13if ( ! defined( 'ABSPATH' ) ) {
14    exit( 0 );
15}
16
17/**
18 * Template variables.
19 *
20 * @var array $template_props
21 */
22
23$track_title    = $template_props['attachment']['title'];
24$track_link     = empty( $template_props['attachment']['link'] ) ? $template_props['attachment']['src'] : $template_props['attachment']['link'];
25$track_duration = ! empty( $template_props['attachment']['duration'] ) ? $template_props['attachment']['duration'] : '';
26
27$class = 'jetpack-podcast-player__track ' . $template_props['secondary_colors']['class'];
28$style = $template_props['secondary_colors']['style'];
29if ( $template_props['is_active'] ) {
30    $class = 'jetpack-podcast-player__track is-active ' . $template_props['primary_colors']['class'];
31    $style = $template_props['primary_colors']['style'];
32}
33
34?>
35
36<li
37    class="<?php echo esc_attr( trim( $class ) ); ?>"
38    style="<?php echo esc_attr( $style ); ?>"
39>
40    <a
41        class="jetpack-podcast-player__track-link jetpack-podcast-player__link"
42        href="<?php echo esc_url( $track_link ); ?>"
43        role="button"
44        <?php echo $template_props['is_active'] ? 'aria-current="track"' : ''; ?>
45    >
46        <span class="jetpack-podcast-player__track-status-icon"></span>
47        <span class="jetpack-podcast-player__track-title"><?php echo esc_html( $track_title ); ?></span>
48        <time class="jetpack-podcast-player__track-duration"><?php echo esc_html( $track_duration ); ?></time>
49    </a>
50</li>