<?php
/**
 * Landofcoder
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Landofcoder.com license that is
 * available through the world-wide-web at this URL:
 * https://landofcoder.com/terms
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade this extension to newer
 * version in the future.
 *
 * @category   Landofcoder
 * @package    Lof_Formbuilder
 * @copyright  Copyright (c) 2021 Landofcoder (https://www.landofcoder.com/)
 * @license    https://landofcoder.com/terms
 */

$helper_data       = $this->helper("Lof\Formbuilder\Helper\Data");
$field       = $this->getData('field_data');
$form        = $block->getForm();
$field_type  = $field['field_type'];
$label       = $block->filterMessage($field['label']);
$inlineCss   = isset($field['inline_css'])?$field['inline_css']:'';
$cid         = $helper_data->getFieldId($field);
$description ='';
if (isset($field['field_options']["description"])) {
    $description = $block->filterMessage($field['field_options']["description"]);
}
$helper            = $this->helper("Lof\Formbuilder\Helper\Fields");
$field_name        = $helper->getFieldPrefix() . $cid . $form->getId();
$field_id          = $field_name.uniqid();
$options           = $field['field_options'];

$color_label       = isset($options['color_label'])?'color:'.$options['color_label'].';':'';
$color_text        = isset($options['color_text'])?'color:'.$options['color_text'].';':'';
$color_description = isset($options['color_description'])?'color:'.$options['color_description'].';':'';
$background_color  = isset($options['background_color'])?'background-color:'.$options['background_color'].';':'';

$font_size         = isset($options['font_size'])?'font-size:'.(int)$options['font_size'].'px;':'';
$font_style        = isset($options['font_style'])?'font-style:'.$options['font_style'].';':'';
$font_weight       = isset($options['font_weight'])?'font-weight:'.$options['font_weight'].';':'';
$frame_work_css    = '';
if (isset($field['frame_work_css'])) {
    $frame_work_css      = $field['frame_work_css'];
}
if ($frame_work_css =='foundation') {
    $colunm =  isset($field['fieldcol'])?'medium-'.$field['fieldcol']:'medium-12';
} else {
    $colunm =  isset($field['fieldcol'])?'col-sm-'.$field['fieldcol']:'col-sm-12';
}
?>
<div class="subtemplate-wrapper" style="<?= $inlineCss ?>">
    <?php if ($label!='') { ?>
    <label for="<?= $field_id; ?>"> <?= $label; ?></label>
    <?php } ?>
    <div class="row">
        <div class="field-html <?= $colunm; ?>" style="<?= $background_color; ?>">
            <div class="sm-html" style="<?= $color_text.$font_size.$font_style.$font_weight; ?>">
                <?php if ($description !='') { ?>
                <div class="form-custom-html">
                    <?= $description; ?>
                </div>
                <textarea name="<?= $field_name; ?>"  id="<?= $field_id; ?>" style="display:none;" ><?= $description; ?></textarea>
                <?php } ?>
            </div>
        </div>
    </div>
</div>
