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