<?php
$id = $block['id'];
$class = [];

if($block['align']){
    $class[] = 'align'.$block['align'];
}

$style = get_field('style') ? get_field('style') : 'top-icon';
$icon = get_field('icon');
$heading = get_field('heading');
$content = get_field('content');
$enable_link = get_field('enable_link');
$link = get_field('link');

$custom_style_var = get_field('custom_style');
$custom_style = z_custom_style($custom_style_var);

$class[] = $style;

$html .= '';
//if(is_admin()) $html .= '<div style="padding: 20px 0;background-color: #eee;">';

$html .= '<div id="'.$id.'" class="'.implode(' ', $class).'"><div class="z-icontext clearfix" style="'.$custom_style.'">';
    $html .= '<div class="half-container">';
        $html .= '<div class="text-content">';
            $html .= '<span class="icon" style="background-image: url('.THEMEURL.'/assets/images/polygon.svg);background-size: 100% 100%;">'.$icon.'</span>';
            if($enable_link) $html .= '<a href="'.$link['href'].'" target="'.$link['target'].'">';
            $html .= '<h2>'.$heading.'</h2>';
            if($enable_link) $html .= '</a>';
            $html .= apply_filters('the_content', $content);
        $html .= '</div>';
    $html .= '</div>';
$html .= '</div></div>';

//if(is_admin()) $html .= '</div>';

echo $html;