xref: /webtrees/resources/views/components/select-submitter.phtml (revision 37d930cca0f84e25e5504056c7d7ea38b821c885)
1<?php
2
3use Fisharebest\Webtrees\Submitter;
4use Fisharebest\Webtrees\Http\RequestHandlers\TomSelectSubmitter;
5use Fisharebest\Webtrees\Tree;
6
7/**
8 * @var string      $at     "@" or "" (or unset).
9 * @var Submitter|null $submitter
10 * @var string|null       $class
11 * @var string|null       $id
12 * @var string            $name
13 * @var Tree              $tree
14 */
15
16$at = $at ?? '';
17
18?>
19
20<select
21    autocomplete="off"
22    class="form-select tom-select <?= $class ?? '' ?>"
23    data-url="<?= e(route(TomSelectSubmitter::class, ['tree' => $tree->name(), 'at' => $at])) ?>"
24    id="<?= e($id ?? $name) ?>"
25    name="<?= e($name) ?>"
26    <?= ($disabled ?? false) ? 'disabled="disabled"' : '' ?>
27    <?= ($required ?? false) ? 'required="required"' : '' ?>
28>
29    <?php if (($submitter ?? null) instanceof Submitter) : ?>
30        <option value="<?= e($at . $submitter->xref() . $at) ?>">
31            <?= view('selects/submitter', ['submitter' => $submitter]) ?>
32        </option>
33    <?php else : ?>
34        <option value="">&nbsp;</option>
35    <?php endif ?>
36</select>
37