xref: /webtrees/resources/views/components/select-repository.phtml (revision 2452d1ce1eaa0c348ba7298831da4bef9d5d4b80)
1<?php
2
3use Fisharebest\Webtrees\Repository;
4use Fisharebest\Webtrees\Tree;
5
6/**
7 * @var Repository|null $repository
8 * @var string|null $id
9 * @var string      $name
10 * @var Tree        $tree
11 */
12
13?>
14
15<select
16    autocomplete="off"
17    class="form-control select2"
18    data-ajax--delay="350"
19    data-ajax--minimum-input-length="2"
20    data-ajax--type="POST"
21    data-ajax--url="<?= e(route('select2-repository', ['ged' => $tree->name()])) ?>"
22    data-allow-clear="true"
23    id="<?= e($id ?? $name) ?>"
24    name="<?= e($name) ?>"
25    <?= ($disabled ?? false) ? 'disabled' : '' ?>
26    <?= ($required ?? false) ? 'required' : '' ?>
27>
28    <?php if (($repository ?? null) instanceof Repository): ?>
29        <option value="<?= e($repository->xref()) ?>" selected>
30            <?= view('selects/repository', ['repository' => $repository]) ?>
31        </option>
32    <?php else: ?>
33        <option></option>
34    <?php endif ?>
35</select>
36