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