<?php

namespace HulkPlugins\ElementorPro\Forms\InternationalTelephoneField;

use ElementorPro\Modules\Forms\Widgets\Form;
use HulkPlugins\ElementorPro\Forms\InternationalTelephoneField\Utils\Helper;
defined( 'ABSPATH' ) || exit;
/**
 * Field view render
 * @var Form $form
 * @var string $type
 * @var array $item
 * @var string $prefix
 * @var int $item_index
 * @var string $_id
 * @var array $hulk_epfitf_settings
 */
$form->remove_render_attribute( 'input' . $item_index, 'type' );
$hulk_epfitf_settings['_id'] = $_id;
$hulk_epfitf_settings['id'] = $form->get_attribute_id( $item );
$hulk_epfitf_settings['custom_id'] = $item['custom_id'];
$hulk_epfitf_settings['name'] = $form->get_attribute_name( $item );
$hulk_epfitf_settings['class'] = Helper::get_attribute_class_string( $item );
$hulk_epfitf_settings['value'] = $item[$prefix . 'defaultValue'];
$hulk_epfitf_settings['required'] = $item['required'] === 'true';
$hulk_epfitf_settings['placeholder'] = $item[$prefix . 'placeholder'];
$hulk_epfitf_settings['initialCountry'] = $item[$prefix . 'initialCountry'];
$hulk_epfitf_settings['onlyCountries'] = (array) $item[$prefix . 'onlyCountries'];
$hulk_epfitf_settings['excludeCountries'] = (array) $item[$prefix . 'excludeCountries'];
$hulk_epfitf_settings['countryOrder'] = $item[$prefix . 'countryOrder'];
$hulk_epfitf_settings['nationalMode'] = $item[$prefix . 'nationalMode'] === 'yes';
$hulk_epfitf_settings['strictMode'] = $item[$prefix . 'strictMode'] === 'yes';
$hulk_epfitf_settings['enableValidation'] = $item[$prefix . 'enableValidation'] === 'yes';
?>
<div
	class="<?php 
echo esc_attr( $type );
?>_wrap elementor-repeater-item-<?php 
echo esc_attr( $_id );
?>"
	data-settings='<?php 
echo wp_json_encode( Helper::sanitizeSettings( $hulk_epfitf_settings ) );
?>'
	data-id="<?php 
echo esc_attr( $_id );
?>"
>
	<input
		type="text"
		aria-label="<?php 
echo esc_attr__( 'international telephone number', 'international-telephone-field-for-elementor-form' );
?>"
		id="<?php 
echo esc_attr( $hulk_epfitf_settings['id'] );
?>"
		name="<?php 
echo esc_attr( $hulk_epfitf_settings['name'] );
?>"
		class="<?php 
echo esc_attr( $hulk_epfitf_settings['class'] );
?>"
		value="<?php 
echo esc_attr( $hulk_epfitf_settings['value'] );
?>"
		placeholder="<?php 
echo esc_attr( $hulk_epfitf_settings['placeholder'] );
?>"
	>
</div>
<?php 