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