xref: /webtrees/resources/views/components/select-place.phtml (revision b43e8d2bb2c20432b6d427f0f5d9a32679a9aa4f)
1<?php
2
3use Fisharebest\Webtrees\Http\RequestHandlers\Select2Place;
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-control select2 <?= $class ?? '' ?>"
20    data-ajax--delay="<?= e(Select2Place::AJAX_DELAY) ?>"
21    data-minimum-input-length="<?= e(Select2Place::MINIMUM_INPUT_LENGTH) ?>"
22    data-ajax--type="POST"
23    data-ajax--url="<?= e(route(Select2Place::class, ['tree' => $tree->name()])) ?>"
24    data-allow-clear="true"
25    data-placeholder=""
26    id="<?= e($id ?? $name) ?>"
27    name="<?= e($name) ?>"
28    <?= ($disabled ?? false) ? 'disabled' : '' ?>
29    <?= ($required ?? false) ? 'required' : '' ?>
30    style="width:100%"
31>
32    <?php if (($place ?? null) instanceof Place) : ?>
33        <option value="<?= e($place->id()) ?>">
34            <?= view('selects/place', ['place' => $place]) ?>
35        </option>
36    <?php else : ?>
37        <option value="">&nbsp;</option>
38    <?php endif ?>
39</select>
40