xref: /webtrees/resources/views/components/select-place.phtml (revision d1a8402e9ca2ba8e58bd30cfd5a35f2d81ec931b)
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