playlist-track.php
4 years ago
podcast-header-title.php
4 years ago
podcast-header.php
4 years ago
podcast-title.php
4 years ago
podcast-header.php
70 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Podcast Header template. |
| 4 | * |
| 5 | * @package automattic/jetpack |
| 6 | */ |
| 7 | |
| 8 | // phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable -- This file expects $template_props set outside the file. |
| 9 | |
| 10 | namespace Automattic\Jetpack\Extensions\Podcast_Player; |
| 11 | |
| 12 | /** |
| 13 | * Template variables. |
| 14 | * |
| 15 | * @var array $template_props |
| 16 | */ |
| 17 | |
| 18 | /** |
| 19 | * Block attributes. |
| 20 | */ |
| 21 | $attributes = (array) $template_props['attributes']; // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable |
| 22 | $show_cover_art = (bool) $attributes['showCoverArt']; |
| 23 | $show_episode_title = (bool) $attributes['showEpisodeTitle']; |
| 24 | $show_episode_description = (bool) $attributes['showEpisodeDescription']; |
| 25 | |
| 26 | // Current track. |
| 27 | $tracks = $template_props['tracks']; |
| 28 | $track = ( is_array( $tracks ) && ! empty( $tracks ) ) ? $tracks[0] : array(); |
| 29 | ?> |
| 30 | |
| 31 | <div class="jetpack-podcast-player__header"> |
| 32 | <div class="jetpack-podcast-player__current-track-info"> |
| 33 | <?php if ( $show_cover_art && isset( $template_props['cover'] ) ) : ?> |
| 34 | <div class="jetpack-podcast-player__cover"> |
| 35 | <img class="jetpack-podcast-player__cover-image" src="<?php echo esc_url( $template_props['cover'] ); ?>" alt="" /> |
| 36 | </div> |
| 37 | <?php endif; ?> |
| 38 | |
| 39 | <?php |
| 40 | if ( $show_episode_title ) { |
| 41 | render( |
| 42 | 'podcast-header-title', |
| 43 | array( |
| 44 | 'player_id' => $template_props['player_id'], |
| 45 | 'title' => $template_props['title'], |
| 46 | 'link' => $template_props['link'], |
| 47 | 'track' => $track, |
| 48 | 'primary_colors' => $template_props['primary_colors'], |
| 49 | ) |
| 50 | ); |
| 51 | } |
| 52 | ?> |
| 53 | </div> |
| 54 | |
| 55 | <?php |
| 56 | if ( $show_episode_description && ! empty( $track ) && isset( $track['description'] ) ) : |
| 57 | ?> |
| 58 | <div |
| 59 | id="<?php echo esc_attr( $template_props['player_id'] ); ?>__track-description" |
| 60 | class="jetpack-podcast-player__track-description" |
| 61 | > |
| 62 | <?php echo esc_html( $track['description'] ); ?> |
| 63 | </div> |
| 64 | <?php endif; ?> |
| 65 | |
| 66 | <div class="jetpack-podcast-player__audio-player"> |
| 67 | <div class="jetpack-podcast-player--audio-player-loading"></div> |
| 68 | </div> |
| 69 | </div> |
| 70 |