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