xref: /webtrees/resources/views/components/select-submitter.phtml (revision 6f68916103931ce3f715eba5c6f55acf120c084e)
1<?php
2
3use Fisharebest\Webtrees\GedcomRecord;
4use Fisharebest\Webtrees\Http\RequestHandlers\Select2Submitter;
5use Fisharebest\Webtrees\Tree;
6
7/**
8 * @var string      $at     "@" or "" (or unset).
9 * @var GedcomRecord|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-control select2 <?= $class ?? '' ?>"
23    data-ajax--delay="<?= e(Select2Submitter::AJAX_DELAY) ?>"
24    data-minimum-input-length="<?= e(Select2Submitter::MINIMUM_INPUT_LENGTH) ?>"
25    data-ajax--type="POST"
26    data-ajax--url="<?= e(route(Select2Submitter::class, ['tree' => $tree->name(), 'at' => $at])) ?>"
27    data-allow-clear="true"
28    data-placeholder=""
29    id="<?= e($id ?? $name) ?>"
30    name="<?= e($name) ?>"
31    <?= ($disabled ?? false) ? 'disabled' : '' ?>
32    <?= ($required ?? false) ? 'required' : '' ?>
33    style="width:100%"
34>
35    <?php if (($submitter ?? null) instanceof GedcomRecord) : ?>
36        <option value="<?= e($at . $submitter->xref() . $at) ?>">
37            <?= view('selects/submitter', ['submitter' => $submitter]) ?>
38        </option>
39    <?php else : ?>
40        <option value="">&nbsp;</option>
41    <?php endif ?>
42</select>
43