<?php

$html_id = pxl_get_element_id($settings);
if ( ! empty( $settings['button_link_lv1']['url'] ) ) {
    $widget->add_render_attribute( 'button_lv1', 'href', $settings['button_link_lv1']['url'] );

    if ( $settings['button_link_lv1']['is_external'] ) {
        $widget->add_render_attribute( 'button_lv1', 'target', '_blank' );
    }

    if ( $settings['button_link_lv1']['nofollow'] ) {
        $widget->add_render_attribute( 'button_lv1', 'rel', 'nofollow' );
    }
}

if ( ! empty( $settings['button_link_lv2']['url'] ) ) {
    $widget->add_render_attribute( 'button_lv2', 'href', $settings['button_link_lv2']['url'] );

    if ( $settings['button_link_lv2']['is_external'] ) {
        $widget->add_render_attribute( 'button_lv2', 'target', '_blank' );
    }

    if ( $settings['button_link_lv2']['nofollow'] ) {
        $widget->add_render_attribute( 'button_lv2', 'rel', 'nofollow' );
    }
}

$show_new = $widget->get_setting('show_new');
?>
<div class="pxl-showcase pxl-showcase1">
	<div class="pxl-item--inner <?php echo esc_attr($settings['style']); ?> <?php echo esc_attr($settings['pxl_animate']); ?>" data-wow-delay="<?php echo esc_attr($settings['pxl_animate_delay']); ?>ms">
		<div class="pxl-image-bg">
			<?php if($show_new == 'true'): ?>
				<div class="pxl-item-new">
					<?php echo pxl_print_html($settings['title_new']); ?>
				</div>
			<?php endif; ?>
			<div class="pxl-item--image">
				<?php if(!empty($settings['image']['id'])) : 
					$image_size = !empty($settings['img_size']) ? $settings['img_size'] : '1000x814'; 
					$img = pxl_get_image_by_size( array(
						'attach_id'  => $settings['image']['id'],
						'thumb_size' => $image_size,
					));
					$thumbnail = $img['thumbnail'];
					?>
					<a <?php pxl_print_html($widget->get_render_attribute_string( 'button_lv1' )); ?>>
						<?php echo pxl_print_html($thumbnail); ?>
					</a>
				<?php endif; ?>
			</div>		
		</div>


		<div class="pxl-inner-meta">
			<div class="pxl-item--meta">
				<?php if ( ! empty( $settings['title'] ) ) : ?>
	            	<h5 class="pxl-item--title"><?php echo pxl_print_html($settings['title']); ?></h5>
	            <?php endif; ?>
	        </div>
	        <div class="pxl-item--buttons">
				<?php if(!empty($settings['button_text_lv1'])) : ?>
		            <div class="pxl-item--button pxl-mr-18 pxl-pr-17">
		                <a class="btn-showcase" <?php pxl_print_html($widget->get_render_attribute_string( 'button_lv1' )); ?>>
		                	<?php echo pxl_print_html($settings['button_text_lv1']); ?>
		                	 <span class="pxl-btn-icon pxl-ml-7">
					            <svg xmlns="http://www.w3.org/2000/svg" fill="#000" height="512" viewBox="0 0 24 24" width="512"><path d="m16.0039 9.414-8.60699 8.607-1.414-1.414 8.60599-8.607h-7.58499v-2h10.99999v11h-2z" fill="rgb(0,0,0)"></path>
					            </svg>       
				            </span>
		                </a>
		            </div>
		        <?php endif; ?>
		        <?php if(!empty($settings['button_text_lv2'])) : ?>
			        <div class="pxl-item--button">
		                <a class="btn-showcase style-lv2" <?php pxl_print_html($widget->get_render_attribute_string( 'button_lv2' )); ?>>
		                	<?php echo pxl_print_html($settings['button_text_lv2']); ?>
		                	<span class="pxl-btn-icon pxl-ml-7">
					            <svg xmlns="http://www.w3.org/2000/svg" fill="#000" height="512" viewBox="0 0 24 24" width="512"><path d="m16.0039 9.414-8.60699 8.607-1.414-1.414 8.60599-8.607h-7.58499v-2h10.99999v11h-2z" fill="rgb(0,0,0)"></path>
					            </svg>       
				            </span>
		                </a>
		            </div>
	            <?php endif; ?>
			</div>
		</div>
	</div>
</div>