<?php

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

class InputPhoneSettings extends \GriffinForms\Admin\Html\FormControls\Field\FieldSettings\Format
{
    protected $display_mode;

    protected function setDisplayMode()
    {
        $options = $this->choices->getChoices('phone_display_mode_inputphone');
        $this->display_mode = $this->fixEmptyValue('phone_display_mode', 'flag_code', $options);
    }

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

    protected function displayModeField()
    {
        $options = $this->choices->getChoices('phone_display_mode_inputphone');
        $field = new \GriffinForms\Admin\Html\FormControls\SelectField($this->name . '_phone_display_mode', $this->display_mode);
        $field->selectOptions($options);
        echo '<label class="form-label me-2 mb-0">' . esc_html($this->lang->getText('phone_display_mode_label')) . '</label>';
        $field->html();
        echo '<p class="text-secondary small mb-0">' . esc_html($this->lang->getText('phone_display_mode_description')) . '</p>';
    }
}
