Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 35
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2/**
3 * Podcast Header 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
13/**
14 * Template variables.
15 *
16 * @var array  $template_props
17 */
18
19/**
20 * Block attributes.
21 */
22$attributes               = (array) $template_props['attributes']; // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
23$show_cover_art           = (bool) $attributes['showCoverArt'];
24$show_episode_title       = (bool) $attributes['showEpisodeTitle'];
25$show_episode_description = (bool) $attributes['showEpisodeDescription'];
26
27// Current track.
28$tracks = $template_props['tracks'];
29$track  = ( is_array( $tracks ) && ! empty( $tracks ) ) ? $tracks[0] : array();
30?>
31
32<div class="jetpack-podcast-player__header">
33    <div class="jetpack-podcast-player__current-track-info">
34        <?php if ( $show_cover_art && isset( $template_props['cover'] ) ) : ?>
35            <div class="jetpack-podcast-player__cover">
36                <img class="jetpack-podcast-player__cover-image" src="<?php echo esc_url( $template_props['cover'] ); ?>" alt="" />
37            </div>
38        <?php endif; ?>
39
40        <?php
41        if ( $show_episode_title ) {
42            render(
43                'podcast-header-title',
44                array(
45                    'player_id'      => $template_props['player_id'],
46                    'title'          => $template_props['title'],
47                    'link'           => $template_props['link'],
48                    'track'          => $track,
49                    'primary_colors' => $template_props['primary_colors'],
50                )
51            );
52        }
53        ?>
54    </div>
55
56    <?php
57    if ( $show_episode_description && ! empty( $track ) && isset( $track['description'] ) ) :
58        ?>
59    <div
60        id="<?php echo esc_attr( $template_props['player_id'] ); ?>__track-description"
61        class="jetpack-podcast-player__track-description"
62    >
63        <?php echo esc_html( $track['description'] ); ?>
64    </div>
65    <?php endif; ?>
66
67    <div class="jetpack-podcast-player__audio-player">
68        <div class="jetpack-podcast-player--audio-player-loading"></div>
69    </div>
70</div>