File: /home/salamatk/takarzan.ir/wp-content/themes/xts-luman/templates/elementor/marquee.php
<?php
/**
* Marquee template function
*
* @package xts
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Direct access not allowed.
}
if ( ! function_exists( 'xts_marquee_template' ) ) {
/**
* Marquee template
*
* @since 1.6.0
*
* @param array $element_args Associative array of arguments.
* @param object $marquee Marquee Object.
*/
function xts_marquee_template( $element_args, $marquee ) {
$marquee->add_render_attribute(
array(
'wrapper' => array(
'class' => array(
'xts-marquee',
'yes' === $element_args['paused_on_hover'] ? 'xts-with-pause' : '',
),
),
)
);
$icon_output = '';
if ( 'image' === $element_args['icon_type'] && ! empty( $element_args['icon_image']['id'] ) ) {
$icon_output = xts_get_image_html( $element_args, 'icon_image' );
if ( 'custom' === $element_args['icon_image_size'] && ! empty( $element_args['icon_image_custom_dimension'] ) ) {
$icon_output = xts_get_svg_html( $element_args['icon_image']['id'], $element_args['icon_image_custom_dimension'] );
} else {
$icon_output = xts_get_svg_html( $element_args['icon_image']['id'], $element_args['icon_image_size'] );
}
} elseif ( 'icon' === $element_args['icon_type'] && ! empty( $element_args['icon'] ) ) {
$icon_output = xts_elementor_get_render_icon( $element_args['icon'] );
}
$custom_image_size = ! empty( $element_args['icon_image_custom_dimension']['width'] ) ? $element_args['icon_image_custom_dimension'] : array(
'width' => 128,
'height' => 128,
);
$content_html = '';
foreach ( $element_args['marquee_contents'] as $index => $item ) {
$item_icon_output = $icon_output;
$item['icon_image_size'] = ! empty( $item['icon_image_size'] ) ? $item['icon_image_size'] : 'thumbnail';
$item['link']['class'] = 'xts-fill';
$link_attrs = '';
if ( isset( $item['link'] ) ) {
$link_attrs = xts_get_link_attrs( $item['link'] );
}
if ( empty( $item['icon_image_custom_dimension']['width'] ) ) {
$item['icon_image_custom_dimension'] = $custom_image_size;
}
if ( 'image' === $item['icon_type'] && ! empty( $item['icon_image']['id'] ) ) {
$item_icon_output = xts_get_image_html( $item, 'icon_image' );
$icon_output_size = 'custom' === $item['icon_image_size'] ? $item['icon_image_custom_dimension'] : $item['icon_image_size'];
if ( xts_is_svg( $item['icon_image']['url'] ) ) {
$item_icon_output = xts_get_svg_html( $item['icon_image']['id'], $icon_output_size );
}
}
ob_start();
?>
<span>
<span class="xts-icon">
<?php echo ! empty( $item_icon_output ) ? $item_icon_output : $icon_output; // phpcs:ignore.?>
</span>
<?php if ( ! empty( $item['text'] ) ) : ?>
<?php echo do_shortcode( shortcode_unautop( $item['text'] ) ); ?>
<?php endif; ?>
<?php if ( isset( $item['link']['url'] ) && $item['link']['url'] ) : ?>
<a <?php echo wp_kses( $link_attrs, true ); ?> aria-label="<?php esc_attr_e( 'Marquee item link', 'xts-theme' ); ?>"></a>
<?php endif; ?>
</span>
<?php
$content_html .= ob_get_clean();
}
?>
<div <?php echo wp_kses( $marquee->get_render_attribute_string( 'wrapper' ), true ); ?>>
<div class="xts-marquee-content">
<?php echo xts_wp_kses_media( $content_html ); // phpcs:ignore ?>
</div>
<div class="xts-marquee-content">
<?php echo xts_wp_kses_media( $content_html ); // phpcs:ignore ?>
</div>
</div>
<?php
}
}