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