xref: /webtrees/resources/views/components/select-note.phtml (revision 6232931fa0cebfba2f226855a8d2e05aa0780d5c)
1b6c326d8SGreg Roach<?php
2b6c326d8SGreg Roach
310e06497SGreg Roachdeclare(strict_types=1);
410e06497SGreg Roach
5c8d78f19SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\TomSelectNote;
6*6232931fSGreg Roachuse Fisharebest\Webtrees\I18N;
7b6c326d8SGreg Roachuse Fisharebest\Webtrees\Note;
8b6c326d8SGreg Roachuse Fisharebest\Webtrees\Tree;
9b6c326d8SGreg Roach
10b6c326d8SGreg Roach/**
1167657255SGreg Roach * @var string      $at     "@" or "" (or unset).
12b6c326d8SGreg Roach * @var Note|null   $note
136bdf2178SGreg Roach * @var string|null $class
14b6c326d8SGreg Roach * @var string|null $id
15b6c326d8SGreg Roach * @var string      $name
16b6c326d8SGreg Roach * @var Tree        $tree
17b6c326d8SGreg Roach */
18b6c326d8SGreg Roach
1967657255SGreg Roach$at = $at ?? '';
2067657255SGreg Roach
21b6c326d8SGreg Roach?>
22b6c326d8SGreg Roach
23b6c326d8SGreg Roach<select
24b6c326d8SGreg Roach    autocomplete="off"
25c8d78f19SGreg Roach    class="form-select tom-select <?= $class ?? '' ?>"
26*6232931fSGreg Roach    data-wt-url="<?= e(route(TomSelectNote::class, ['tree' => $tree->name(), 'at' => $at])) ?>"
27*6232931fSGreg Roach    data-wt-i18n-no-results="<?= I18N::translate('No results found') ?>"
28b6c326d8SGreg Roach    id="<?= e($id ?? $name) ?>"
29b6c326d8SGreg Roach    name="<?= e($name) ?>"
30c8d78f19SGreg Roach    <?= ($disabled ?? false) ? 'disabled="disabled"' : '' ?>
31c8d78f19SGreg Roach    <?= ($required ?? false) ? 'required="required"' : '' ?>
32b6c326d8SGreg Roach>
33b6c326d8SGreg Roach    <?php if (($note ?? null) instanceof Note) : ?>
3467657255SGreg Roach        <option value="<?= e($at . $note->xref() . $at) ?>">
35b6c326d8SGreg Roach            <?= view('selects/note', ['note' => $note]) ?>
36b6c326d8SGreg Roach        </option>
37b6c326d8SGreg Roach    <?php else : ?>
38027478c2SGreg Roach        <option value="">&nbsp;</option>
39b6c326d8SGreg Roach    <?php endif ?>
40b6c326d8SGreg Roach</select>
41