<?php
$default_settings = [
    'banner_image' => '',
    'banner_title' => '',
    'banner_desc' => '',
    'btn_text' => '',
    'btn_link' => '',
    'img_size' => '',
    'ct_animate' => '',
];
$settings = array_merge($default_settings, $settings);
extract($settings);
if(!empty($banner_image['id'])) : 
	$size = '660x400';
	if(!empty($img_size)) {
	    $size = $img_size;
	} else {
	    $size = '660x400';
	}
	$size = '660x410';
	$img = ct_get_image_by_size( array(
		'attach_id'  => $banner_image['id'],
		'thumb_size' => $size,
		'class' => 'ct-banner-image1'
	));
	$thumbnail = $img['thumbnail'];
	if ( ! empty( $btn_link['url'] ) ) {
	    $widget->add_render_attribute( 'banner', 'href', $btn_link['url'] );

	    if ( $btn_link['is_external'] ) {
	        $widget->add_render_attribute( 'banner', 'target', '_blank' );
	    }

	    if ( $btn_link['nofollow'] ) {
	        $widget->add_render_attribute( 'banner', 'rel', 'nofollow' );
	    }
	}
	?>
	<div class="ct-banner2 <?php echo esc_attr($ct_animate); ?>">
		<div class="ct-banner-inner">
			<?php echo wp_kses_post($thumbnail); ?>
			<div class="item--holder">
				<h4 class="item--title el-empty"><?php echo esc_attr($banner_title); ?></h4>
				<div class="item--desc el-empty"><?php echo esc_attr($banner_desc); ?></div>
				<?php if(!empty($btn_text)) : ?>
					<div class="item--button">
						<a <?php ct_print_html($widget->get_render_attribute_string( 'banner' )); ?>><?php echo esc_attr($btn_text); ?><i class="flaticon flaticon-arrow"></i></a>
					</div>
				<?php endif; ?>
			</div>
		</div>
	</div>
<?php endif; ?>