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