xref: /webtrees/resources/views/components/select-family.phtml (revision 6ccdf4f0fd1b65a5d54259c969912382ce49629d)
1<?php
2
3use Fisharebest\Webtrees\Family;
4use Fisharebest\Webtrees\Tree;
5
6/**
7 * @var Family|null $family
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-family', ['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 (($family ?? null) instanceof Family): ?>
29        <option value="<?= e($family->xref()) ?>" selected>
30            <?= view('selects/family', ['family' => $family]) ?>
31        </option>
32    <?php else: ?>
33        <option></option>
34    <?php endif ?>
35</select>
36