Нет описания

podcast-header.php 1.9KB

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