xref: /webtrees/resources/views/components/select-place.phtml (revision 45ebc6c6221f90468111ed2015b8449dca331d93)
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) : ?>
29        <option value="<?= e($place->id()) ?>">
30            <?= view('selects/place', ['place' => $place]) ?>
31        </option>
32    <?php else : ?>
33        <option value="">&nbsp;</option>
34    <?php endif ?>
35</select>
36