summaryrefslogtreecommitdiff
path: root/resources/views/components/select-location.phtml
blob: 1293eeaa231c30265327d3412889751aeb40f5bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php

declare(strict_types=1);

use Fisharebest\Webtrees\Http\RequestHandlers\TomSelectLocation;
use Fisharebest\Webtrees\Location;
use Fisharebest\Webtrees\Tree;

/**
 * @var string        $at "@" or "" (or unset).
 * @var Location|null $location
 * @var string|null   $class
 * @var string|null   $id
 * @var string        $name
 * @var Tree          $tree
 */

$at = $at ?? '';

?>

<select
    autocomplete="off"
    class="form-select tom-select <?= $class ?? '' ?>"
    data-url="<?= e(route(TomSelectLocation::class, ['tree' => $tree->name(), 'at' => $at])) ?>"
    id="<?= e($id ?? $name) ?>"
    name="<?= e($name) ?>"
    <?= ($disabled ?? false) ? 'disabled="disabled"' : '' ?>
    <?= ($required ?? false) ? 'required="required"' : '' ?>
>
    <?php if (($location ?? null) instanceof Location) : ?>
        <option value="<?= e($at . $location->xref() . $at) ?>">
            <?= view('selects/location', ['location' => $location]) ?>
        </option>
    <?php else : ?>
        <option value="">&nbsp;</option>
    <?php endif ?>
</select>