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

<div class="std-field-wrap">
    <label><?php esc_html_e('Date Format', 'subscribe-to-download'); ?></label>
    <div class="std-field">
        <select name="<?php echo esc_attr($field_name_prefix) ?>[date_format]">
            <?php
            $std_datepicker_formats = array(
                array('format' => 'mm/dd/yy', 'label' => esc_html__('Default', 'subscribe-to-download')),
                array('format' => 'yy-mm-dd', 'label' => esc_html__('ISO 8601', 'subscribe-to-download')),
                array('format' => 'd M, y', 'label' => esc_html__('Short', 'subscribe-to-download')),
                array('format' => 'd MM, y', 'label' => esc_html__('Medium', 'subscribe-to-download')),
                array('format' => 'DD, d MM, yy', 'label' => esc_html__('DD, d MM, yy', 'subscribe-to-download')),
                array('format' => "'day' d 'of' MM 'in the year' yy", 'label' => esc_html__('With text', 'subscribe-to-download'))
            );
            $selected_datepicker_format = (!empty($field_details['date_format'])) ? $field_details['date_format'] : 'mm/dd/yy';
            $std_datepicker_formats = apply_filters('std_datepicker_formats', $std_datepicker_formats);
            foreach ($std_datepicker_formats as $datepicker_format_array) {
            ?>
                <option value="<?php echo esc_attr($datepicker_format_array['format']); ?>" <?php selected($selected_datepicker_format, $datepicker_format_array['format']) ?>><?php echo esc_html($datepicker_format_array['label']); ?> - <?php echo esc_html($datepicker_format_array['format']); ?></option>
            <?php
            }
            ?>
        </select>
    </div>
</div>