<?php

namespace GriffinForms\Admin\Html\FormControls\Field\FieldSettings;

class InputDateSettings extends \GriffinForms\Admin\Html\FormControls\Field\FieldSettings\Format
{
    protected $date_format;

    protected function setDateFormat()
    {
        $this->date_format = isset($this->value['date_format']) ? $this->value['date_format'] : 'yy-mm-dd';
    }

    public function html()
    {
        $this->dateFormatField();
    }

    protected function dateFormatField()
    {
        $options = $this->choices->getChoices('date_format');
        $field = new \GriffinForms\Admin\Html\FormControls\SelectField($this->name . '_date_format', $this->date_format);
        $field->selectOptions($options);
        $field->html();
    }
}