<?php
/**
 * Template for a roundup item.
 *
 * @var string $item_classes Classes for the roundup item element.
 * @var string $link_start   Starting HTML for a link.
 * @var string $link_end     Ending HTML for a link.
 * @var string $number_html  HTML for the number to display.
 * @var string $media_html   HTML for the media to display.
 * @var string $button_html  HTML for the button to display (if enabled).
 *
 * @package Tasty_Roundups
 */

?>
<div class="<?php echo esc_attr( $item_classes ); ?>" data-tasty-roundups-customization="block-border-color.border-color block-border-radius.border-radius block-border-width.border-width block-background-color.background">
	<?php if ( ! empty( $media_html ) ) : ?>
	<div class="tasty-roundups-legacy-image-container">
		<?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
		<?php echo $link_start; ?><?php echo $media_html; ?><?php echo $link_end; ?>
	</div>
	<?php endif; ?>
	<div class="tasty-roundups-legacy-content-container">
		<?php if ( ! empty( $attributes['title'] ) ) : ?>
			<?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
		<h2 class="tasty-roundups-legacy-title" data-tasty-roundups-customization="heading-color.color"><?php echo $number_html; ?><?php echo wp_kses_post( $attributes['title'] ); ?></h2>
		<?php endif; ?>
		<?php
		if ( ! empty( $attributes['description'] ) ) {
			$description = wpautop( $attributes['description'] );
			$description = str_replace(
				'<p>',
				'<p class="tasty-roundups-legacy-description" data-tasty-roundups-customization="text-color.color">',
				$description
			);
			echo wp_kses_post( $description );
		}
		?>
		<?php if ( ! empty( $button_html ) && ! empty( $link_start ) ) : ?>
		<div class="tasty-roundups-legacy-button-container">
			<?php echo wp_kses_post( $button_html ); ?>
		</div>
		<?php endif; ?>
	</div>
</div>