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