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