kollapsminoriteten/wp-content/plugins/jetpack/extensions/blocks/podcast-player/templates/podcast-header.php

70 lines
2.0 KiB
PHP
Raw Normal View History

2020-05-06 17:20:49 +02:00
<?php
/**
* Podcast Header template.
*
2021-04-27 08:32:47 +02:00
* @package automattic/jetpack
2020-05-06 17:20:49 +02:00
*/
2022-04-02 10:26:41 +02:00
// phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable -- This file expects $template_props set outside the file.
2020-05-06 17:20:49 +02:00
namespace Automattic\Jetpack\Extensions\Podcast_Player;
/**
* Template variables.
*
* @var array $template_props
*/
/**
2022-04-02 10:26:41 +02:00
* Block attributes.
2020-05-06 17:20:49 +02:00
*/
$attributes = (array) $template_props['attributes']; // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
$show_cover_art = (bool) $attributes['showCoverArt'];
2020-11-18 09:10:44 +01:00
$show_episode_title = (bool) $attributes['showEpisodeTitle'];
2020-05-06 17:20:49 +02:00
$show_episode_description = (bool) $attributes['showEpisodeDescription'];
// Current track.
$tracks = $template_props['tracks'];
$track = ( is_array( $tracks ) && ! empty( $tracks ) ) ? $tracks[0] : array();
?>
<div class="jetpack-podcast-player__header">
<div class="jetpack-podcast-player__current-track-info">
2022-04-02 10:26:41 +02:00
<?php if ( $show_cover_art && isset( $template_props['cover'] ) ) : ?>
2020-05-06 17:20:49 +02:00
<div class="jetpack-podcast-player__cover">
2022-04-02 10:26:41 +02:00
<img class="jetpack-podcast-player__cover-image" src="<?php echo esc_url( $template_props['cover'] ); ?>" alt="" />
2020-05-06 17:20:49 +02:00
</div>
<?php endif; ?>
<?php
2020-11-18 09:10:44 +01:00
if ( $show_episode_title ) {
2020-05-06 17:20:49 +02:00
render(
'podcast-header-title',
array(
2022-04-02 10:26:41 +02:00
'player_id' => $template_props['player_id'],
'title' => $template_props['title'],
'link' => $template_props['link'],
2020-05-06 17:20:49 +02:00
'track' => $track,
2022-04-02 10:26:41 +02:00
'primary_colors' => $template_props['primary_colors'],
2020-05-06 17:20:49 +02:00
)
);
2020-11-18 09:10:44 +01:00
}
?>
2020-05-06 17:20:49 +02:00
</div>
<?php
if ( $show_episode_description && ! empty( $track ) && isset( $track['description'] ) ) :
?>
<div
2022-04-02 10:26:41 +02:00
id="<?php echo esc_attr( $template_props['player_id'] ); ?>__track-description"
2020-05-06 17:20:49 +02:00
class="jetpack-podcast-player__track-description"
>
<?php echo esc_html( $track['description'] ); ?>
</div>
<?php endif; ?>
<div class="jetpack-podcast-player__audio-player">
<div class="jetpack-podcast-player--audio-player-loading"></div>
</div>
</div>