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