xref: /webtrees/resources/views/components/select-place.phtml (revision 3b49aa7b9a581e847403c99e295596cc59a5783c)
1<?php
2
3use Fisharebest\Webtrees\Http\RequestHandlers\AbstractSelect2Handler;
4use Fisharebest\Webtrees\Http\RequestHandlers\Select2Place;
5use Fisharebest\Webtrees\Place;
6use Fisharebest\Webtrees\Tree;
7
8/**
9 * @var Place|null  $place
10 * @var string|null $class
11 * @var string|null $id
12 * @var string      $name
13 * @var Tree        $tree
14 */
15
16?>
17
18<select
19    autocomplete="off"
20    class="form-select select2 <?= $class ?? '' ?>"
21    data-ajax--delay="<?= e(AbstractSelect2Handler::AJAX_DELAY) ?>"
22    data-minimum-input-length="<?= e(AbstractSelect2Handler::MINIMUM_INPUT_LENGTH) ?>"
23    data-ajax--type="POST"
24    data-ajax--url="<?= e(route(Select2Place::class, ['tree' => $tree->name()])) ?>"
25    data-allow-clear="true"
26    data-placeholder=""
27    id="<?= e($id ?? $name) ?>"
28    name="<?= e($name) ?>"
29    <?= ($disabled ?? false) ? 'disabled' : '' ?>
30    <?= ($required ?? false) ? 'required' : '' ?>
31    style="width:100%"
32>
33    <?php if (($place ?? null) instanceof Place) : ?>
34        <option value="<?= e($place->id()) ?>">
35            <?= view('selects/place', ['place' => $place]) ?>
36        </option>
37    <?php else : ?>
38        <option value="">&nbsp;</option>
39    <?php endif ?>
40</select>
41