<?php
defined('ABSPATH') or die('No script kiddies please!!');
?>

<div class="std-field-wrap">
    <label><?php esc_html_e('Label', 'subscribe-to-download'); ?></label>
    <div class="std-field">
        <input type="text" name="<?php echo esc_attr($field_name_prefix) ?>[label]" value="<?php echo (!empty($field_details['label'])) ? esc_attr($field_details['label']) : ''; ?>">
        <p class="description"><?php esc_html_e('This label is just for recognizing the field. This field won\'t show in the form.', 'subscribe-to-download'); ?></p>
    </div>
</div>
<div class="std-field-wrap">
    <label><?php esc_html_e('Hidden Field Type', 'subscribe-to-download'); ?></label>
    <div class="std-field">
        <select name="<?php echo esc_attr($field_name_prefix); ?>[hidden_field_type]" class="std-toggle-trigger" data-toggle-class="std-hidden-field-ref">
            <?php
            $selected_hidden_field_type = (!empty($field_details['hidden_field_type'])) ? $field_details['hidden_field_type'] : 'current_page_url';
            ?>
            <option value="current_page_url" <?php selected($selected_hidden_field_type, 'current_page_url'); ?>><?php esc_html_e('Current Page URL', 'subscribe-to-download'); ?></option>
            <option value="user_ip" <?php selected($selected_hidden_field_type, 'user_ip'); ?>><?php esc_html_e('User Public IP', 'subscribe-to-download'); ?></option>
            <option value="request" <?php selected($selected_hidden_field_type, 'request'); ?>><?php esc_html_e('URL/$_REQUEST Parameter', 'subscribe-to-download'); ?></option>
            <option value="prefilled" <?php selected($selected_hidden_field_type, 'prefilled'); ?>><?php esc_html_e('Pre Filled Value', 'subscribe-to-download'); ?></option>
        </select>
    </div>
</div>
<div class="std-field-wrap std-hidden-field-ref <?php echo ($selected_hidden_field_type != 'request') ? 'std-display-none' : ''; ?>" data-toggle-ref="request">
    <label><?php esc_html_e('URL/$_REQUEST Parameter Key', 'subscribe-to-download'); ?></label>
    <div class="std-field">
        <input type="text" name="<?php echo esc_attr($field_name_prefix); ?>[url_parameter_key]" value="<?php echo (!empty($field_details['url_parameter_key'])) ? esc_attr($field_details['url_parameter_key']) : ''; ?>" />
    </div>
</div>
<div class="std-field-wrap std-hidden-field-ref <?php echo ($selected_hidden_field_type != 'prefilled') ? 'std-display-none' : ''; ?>" data-toggle-ref="prefilled">
    <label><?php esc_html_e('Pre Filled Value', 'subscribe-to-download'); ?></label>
    <div class="std-field">
        <input type="text" name="<?php echo esc_attr($field_name_prefix); ?>[pre_filled_value]" value="<?php echo (!empty($field_details['pre_filled_value'])) ? esc_attr($field_details['pre_filled_value']) : ''; ?>" />
    </div>
</div>