xref: /webtrees/resources/views/components/select-media.phtml (revision c8d78f19d0bdf4c0ec4728253bd37250d2e6cec4)
1b6c326d8SGreg Roach<?php
2b6c326d8SGreg Roach
3*c8d78f19SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\AbstractTomSelectHandler;
4*c8d78f19SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\TomSelectMediaObject;
5b6c326d8SGreg Roachuse Fisharebest\Webtrees\Media;
6b6c326d8SGreg Roachuse Fisharebest\Webtrees\Tree;
7b6c326d8SGreg Roach
8b6c326d8SGreg Roach/**
967657255SGreg Roach * @var string      $at     "@" or "" (or unset).
10b6c326d8SGreg Roach * @var Media|null  $media
116bdf2178SGreg Roach * @var string|null $class
12b6c326d8SGreg Roach * @var string|null $id
13b6c326d8SGreg Roach * @var string      $name
14b6c326d8SGreg Roach * @var Tree        $tree
15b6c326d8SGreg Roach */
16b6c326d8SGreg Roach
1767657255SGreg Roach$at = $at ?? '';
1867657255SGreg Roach
19b6c326d8SGreg Roach?>
20b6c326d8SGreg Roach
21b6c326d8SGreg Roach<select
22b6c326d8SGreg Roach    autocomplete="off"
23*c8d78f19SGreg Roach    class="form-select tom-select <?= $class ?? '' ?>"
24*c8d78f19SGreg Roach    data-url="<?= e(route(TomSelectMediaObject::class, ['tree' => $tree->name(), 'at' => $at])) ?>"
25b6c326d8SGreg Roach    id="<?= e($id ?? $name) ?>"
26b6c326d8SGreg Roach    name="<?= e($name) ?>"
27*c8d78f19SGreg Roach    <?= ($disabled ?? false) ? 'disabled="disabled"' : '' ?>
28*c8d78f19SGreg Roach    <?= ($required ?? false) ? 'required="required"' : '' ?>
29b6c326d8SGreg Roach>
30b6c326d8SGreg Roach    <?php if (($media ?? null) instanceof Media) : ?>
3167657255SGreg Roach        <option value="<?= e($at . $media->xref() . $at) ?>">
32b6c326d8SGreg Roach            <?= view('selects/media', ['media' => $media]) ?>
33b6c326d8SGreg Roach        </option>
34b6c326d8SGreg Roach    <?php else : ?>
35027478c2SGreg Roach        <option value="">&nbsp;</option>
36b6c326d8SGreg Roach    <?php endif ?>
37b6c326d8SGreg Roach</select>
38