<?php
    $fieldOptions = $field->options();
?>
<!-- Dropdown -->
<?php if ($this->previewMode): ?>
    <div class="form-control"><?= (isset($fieldOptions[$field->value])) ? e($fieldOptions[$field->value]) : '' ?></div>
<?php else: ?>
    <select
        id="<?= $field->getId() ?>"
        name="<?= $field->getName() ?>"
        class="form-control custom-select"
        <?= $field->getAttributes() ?>>
        <?php if ($field->placeholder): ?>
            <option value=""><?= e(trans($field->placeholder)) ?></option>
        <?php endif ?>
        <?php foreach ($fieldOptions as $value => $option): ?>
            <?php
                if (!is_array($option)) $option = [$option];
            ?>
            <option
                <?= $value == $field->value ? 'selected="selected"' : '' ?>
                <?php if (isset($option[1])): ?>data-<?=strpos($option[1],'.')?'image':'icon'?>="<?= $option[1] ?>"<?php endif ?>
                value="<?= $value ?>">
                    <?= e(trans($option[0])) ?>
            </option>
        <?php endforeach ?>
    </select>
<?php endif?>