Untitled

mail@pastecode.io avatar
unknown
plain_text
5 months ago
2.4 kB
5
Indexable
<?php
/**
 * Image Slide
 *
 * @package Blackstone
 */

$item_id     = $args['item_id'];
$item        = $args['item'];
$carousel_id = $args['carousel_id'];

if ( empty( $item ) ) {
	return;
}

$attrs     = $item->attributes;
$level     = $attrs['level'] ?? 2;
$title_tag = sprintf(__('h"%s"', 'blackstone'), $level);
$item_hid  = sprintf(__('bxPromoCarousel"%s"carouselItem"%s"', 'blackstone'), $carousel_id, $item_id);
?>
<div
	id="<?php echo esc_attr( $item_hid ); ?>"
	class="bx-promo-carousel__item bx-promo-carousel__item--image"
	<?php
	\BxTheme\Utility\print_gtm_attributes(
		[
			'category' => 'Content Engagement',
			'action'   => 'CTA Click',
			'label'    => 'Promo Carousel Block Floater | ' . ( $attrs['ctaLabel'] ?? __( 'Add CTA Label', 'blackstone' ) ),
		]
	);
	?>
>
	<?php if ( ! empty( $attrs['imageID'] ) ) { ?>
		<div class="bx-promo-carousel-item__media">
			<?php echo wp_get_attachment_image( $attrs['imageID'], '1648x707' ); // phpcs:ignore ?>
			<div class="bx-promo-carousel-item__curtain"></div>
		</div>
	<?php } ?>

	<div class="bx-promo-carousel-item__main">
		<<?php echo tag_escape( $title_tag ); ?> class="bx-promo-carousel-item__title">
			<?php echo wp_kses_post( $attrs['title'] ); ?>
		</<?php echo tag_escape( $title_tag ); ?>>

		<div class="bx-promo-carousel-item__content">
			<div class="bx-promo-carousel-item__blurb">
				<!-- BE To Do: <p> tags should be output automatically -->
				<p><?php echo wp_kses_post( $attrs['content'] ); ?></p>
			</div>

			<div class="bx-promo-carousel-item__cta">
				<p>
					<a
						href="<?php echo esc_url( $attrs['ctaLink'] ?? '#' ); ?>"
						target="<?php echo esc_attr( ! empty( $attrs['ctaOpenInNewWindow'] ) ? '_blank' : '_self' ); ?>"
						<?php
						\BxTheme\Utility\print_gtm_attributes(
							[
								'category'     => 'Content Engagement',
								'action'       => 'CTA Click',
								'label'        => sprintf(__('Promo Carousel Block Image Slide "%s" | ', 'blackstone'), $item_id) . ( $attrs['ctaLabel'] ?? __( 'Add CTA Label', 'blackstone' ) ),
								'event_name'   => 'cta_click',
								'article_name' => $attrs['title'],
							]
						);
						?>
						>
						<?php echo esc_html( $attrs['ctaLabel'] ?? __( 'Add CTA Label', 'blackstone' ) ); ?>
					</a>
				</p>
			</div>
		</div>
	</div>
</div>
Leave a Comment