<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>

<div class="ehx-admin-drag-fld ehx-admin-delete-area ehx-field-type-text <?php echo $validated['_column'] == '2' ? 'col-span-1':''; ?>" data-index="<?php echo esc_attr($index ?? 0); ?>">
    <?php foreach($validated as $key => $value): ?>
        <input type="hidden" name="_ehx_custom_field[<?php echo esc_attr($index ?? 0); ?>][<?php echo esc_attr($key); ?>]" value='<?php echo gettype($value) == 'array' ? wp_json_encode($value) : esc_html($value); ?>' class="custom_field" data-key="<?php echo esc_attr($key); ?>">
    <?php endforeach ?>
    
    <div class="ehx-admin-drag-fld-title ehx-field-type-text"><?php echo esc_html($validated['_label']); ?></div>
    <div class="ehx-admin-drag-fld-type ehx-field-type-text"><?php echo esc_html($validated['_metakey']); ?></div>
    <div class="ehx-admin-drag-fld-icons ehx-field-type-text">
        <a href="javascript:void(0);" class="ehx-tip-n" id="openEhxModal" data-key="<?php echo esc_attr($index ?? 0); ?>" data-element="#ehx-modal" data-action="ehxme_custom_field_modal" data-nonce="<?php echo esc_html(wp_create_nonce('ehxme_custom_field_modal')) ?>"><i class="ehx-faicon-pencil"></i></a>
        <a href="javascript:void(0);" class="ehx-tip-n ehx_admin_duplicate_field" id="duplicateField"><i class="ehx-faicon-files-o"></i></a>
        <a href="javascript:void(0);" class="ehx-tip-n" id="deleteField"><i class="ehx-faicon-trash-o"></i></a>
    </div>
    <div class="clear"></div>
</div>