xref: /webtrees/resources/views/components/select-note.phtml (revision 9b93b7c342a543e7bd55b5a09d97ba0c39fc32b0)
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-ajax--minimum-input-length="2"
21    data-ajax--type="POST"
22    data-ajax--url="<?= e(route('select2-note', ['ged' => $tree->name()])) ?>"
23    data-allow-clear="true"
24    id="<?= e($id ?? $name) ?>"
25    name="<?= e($name) ?>"
26    <?= ($disabled ?? false) ? 'disabled' : '' ?>
27    <?= ($required ?? false) ? 'required' : '' ?>
28>
29    <?php if (($note ?? null) instanceof Note): ?>
30        <option value="<?= e($note->xref()) ?>" selected>
31            <?= view('selects/note', ['note' => $note]) ?>
32        </option>
33    <?php else: ?>
34        <option></option>
35    <?php endif ?>
36</select>
37