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