xref: /webtrees/resources/views/components/select-submitter.phtml (revision 2ebb07b4bd8cf7010946ea4d75bb6160666157f6)
1<?php
2
3use Fisharebest\Webtrees\GedcomRecord;
4use Fisharebest\Webtrees\Tree;
5
6/**
7 * @var GedcomRecord|null $submitter
8 * @var string|null       $id
9 * @var string            $name
10 * @var Tree              $tree
11 */
12
13?>
14
15<select
16autocomplete="off"
17class="form-control select2"
18data-ajax--delay="350"
19data-ajax--minimum-input-length="2"
20data-ajax--type="POST"
21data-ajax--url="<?= e(route('select2-submitter', ['ged' => $tree->name()])) ?>"
22data-allow-clear="true"
23id="<?= e($id ?? $name) ?>"
24name="<?= e($name) ?>"
25    <?= ($disabled ?? false) ? 'disabled' : '' ?>
26    <?= ($required ?? false) ? 'required' : '' ?>
27>
28    <?php if (($submitter ?? null) instanceof GedcomRecord): ?>
29        <option value="<?= e($submitter->xref()) ?>" selected>
30            <?= view('selects/submitter', ['submitter' => $submitter]) ?>
31        </option>
32    <?php else: ?>
33        <option></option>
34    <?php endif ?>
35</select>
36