<?php
/**
 * Inline Theme 8 — Card
 *
 * @package Relatedly
 * @since   2.0.0
 * @var array $data Template variables from AbstractTheme::template_vars().
 */
defined( 'ABSPATH' ) || exit;
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound

use Relatedly\Utilities\PostHelpers;
$date = $data['show_date'] ? PostHelpers::formatted_date( $data['post_id'], $data['date_type'] ) : '';
?>
<div class="relatedly-inline relatedly-inline-card"
	style="<?php echo esc_attr( $data['css_vars'] ); ?>"
	data-relatedly-source="<?php echo esc_attr( $data['source_post_id'] ); ?>"
	data-relatedly-type="inline">
	<a href="<?php echo esc_url( $data['permalink'] ); ?>"
		class="relatedly-title relatedly-tracked-link"
		<?php if ( '_blank' === $data['link_target'] ) : ?>target="_blank" rel="noopener noreferrer"<?php elseif ( $data['link_rel'] ) : ?>rel="<?php echo esc_attr( $data['link_rel'] ); ?>"<?php endif; ?>
		<?php if ( $data['source_post_id'] ) : ?>data-relatedly-source="<?php echo esc_attr( $data['source_post_id'] ); ?>" data-relatedly-clicked="<?php echo esc_attr( $data['tracking_post_id'] ); ?>" data-relatedly-type="<?php echo esc_attr( $data['display_type'] ); ?>"<?php endif; ?>
	><?php echo esc_html( $data['title'] ); ?></a>
	<?php if ( $date ) : ?>
		<span class="relatedly-date"><?php echo esc_html( $date ); ?></span>
	<?php endif; ?>
	<?php if ( $data['show_excerpt'] && $data['excerpt'] ) : ?>
		<p class="relatedly-excerpt"><?php echo esc_html( $data['excerpt'] ); ?></p>
	<?php endif; ?>
</div>
