| 1 |
<?php |
| 2 |
/** |
| 3 |
* Podcast Header 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 |
|
| 11 |
namespace Automattic\Jetpack\Extensions\Podcast_Player; |
| 12 |
|
| 13 |
/** |
| 14 |
* Template variables. |
| 15 |
* |
| 16 |
* @var string $template_props |
| 17 |
*/ |
| 18 |
|
| 19 |
if ( ! isset( $template_props['title'] ) && empty( $template_props['track']['title'] ) ) { |
| 20 |
return; |
| 21 |
} |
| 22 |
|
| 23 |
$track_link = empty( $template_props['track']['link'] ) ? $template_props['track']['src'] : $template_props['track']['link']; |
| 24 |
?> |
| 25 |
|
| 26 |
<h2 id="<?php echo esc_attr( $template_props['player_id'] ); ?>__title" class="jetpack-podcast-player__title"> |
| 27 |
<span |
| 28 |
class="jetpack-podcast-player__current-track-title <?php echo esc_attr( $template_props['primary_colors']['class'] ); ?>" |
| 29 |
<?php echo isset( $template_props['primary_colors']['style'] ) ? 'style="' . esc_attr( $template_props['primary_colors']['style'] ) . '"' : ''; ?> |
| 30 |
> |
| 31 |
<?php |
| 32 |
echo esc_html( $template_props['track']['title'] ); |
| 33 |
if ( ! empty( $track_link ) ) : |
| 34 |
// Prevent whitespace between title and link to cause a jump when JS kicks in. |
| 35 |
// phpcs:disable Squiz.PHP.EmbeddedPhp.ContentAfterEnd |
| 36 |
?><a |
| 37 |
class="jetpack-podcast-player__track-title-link" |
| 38 |
href="<?php echo esc_url( $track_link ); ?>" |
| 39 |
target="_blank" |
| 40 |
rel="noopener noreferrer nofollow" |
| 41 |
> |
| 42 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"> |
| 43 |
<path d="M15.6 7.2H14v1.5h1.6c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.8 0 5.2-2.3 5.2-5.2 0-2.9-2.3-5.2-5.2-5.2zM4.7 12.4c0-2 1.7-3.7 3.7-3.7H10V7.2H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H10v-1.5H8.4c-2 0-3.7-1.7-3.7-3.7zm4.6.9h5.3v-1.5H9.3v1.5z" /> |
| 44 |
</svg> |
| 45 |
</a> |
| 46 |
<?php endif; // phpcs:enable ?> |
| 47 |
</span> |
| 48 |
|
| 49 |
<?php |
| 50 |
// phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable -- This file expects $template_props set outside the file. |
| 51 |
|
| 52 |
if ( ! empty( $template_props['title'] ) ) : |
| 53 |
?> |
| 54 |
<span class="jetpack-podcast-player--visually-hidden"> - </span> |
| 55 |
|
| 56 |
<?php |
| 57 |
render( |
| 58 |
'podcast-title', |
| 59 |
array( |
| 60 |
'title' => $template_props['title'], |
| 61 |
'link' => $template_props['link'], |
| 62 |
) |
| 63 |
); |
| 64 |
?> |
| 65 |
<?php endif; ?> |
| 66 |
</h2> |
| 67 |
|