xref: /webtrees/resources/views/edit/add-fact-row.phtml (revision c0dc1dc8776d0d9214741483e39305c5e08e2358)
1<?php use Fisharebest\Webtrees\GedcomTag; ?>
2<?php use Fisharebest\Webtrees\I18N; ?>
3
4<tr>
5    <th scope="row">
6        <?= I18N::translate('Fact or event') ?>
7    </th>
8    <td>
9        <form onsubmit="if ($('#add-fact').val() === null) {event.preventDefault();}">
10            <input type="hidden" name="route" value="add-fact">
11            <input type="hidden" name="xref" value="<?= e($record->xref()) ?>">
12            <input type="hidden" name="ged" value="<?= e($record->tree()->name()) ?>">
13            <div class="input-group">
14                <select class="form-control" id="add-fact" name="fact">
15                    <option value="" disabled selected>
16                        <?= I18N::translate('&lt;select&gt;') ?>
17                    </option>
18                    <?php foreach ($add_facts as $fact => $fact_name) : ?>
19                        <option value="<?= $fact ?>"><?= $fact_name ?></option>
20                    <?php endforeach ?>
21                    <?php if ($record::RECORD_TYPE === 'INDI' || $record::RECORD_TYPE === 'FAM') : ?>
22                        <option value="FACT">
23                        <?= I18N::translate('Custom fact') ?>
24                        </option>
25                    <option value="EVEN">
26                        <?= I18N::translate('Custom event') ?>
27                    </option>
28                    <?php endif ?>
29                </select>
30                <div class="input-group-append">
31                    <button class="btn btn-light" type="submit">
32                        <?= /* I18N: A button label. */ I18N::translate('add') ?>
33                    </button>
34                </div>
35            </div>
36        </form>
37
38        <div class="wt-quick-facts">
39            <?php foreach ($quick_facts as $fact) : ?>
40                <a class="btn btn-link btn-sm wt-quick-fact" href="<?= e(route('add-fact', [
41                    'fact' => $fact,
42                    'xref' => $record->xref(),
43                    'ged'  => $tree->name(),
44                ])) ?>">
45                    <?= GedcomTag::getLabel($fact) ?>
46                </a>
47            <?php endforeach ?>
48        </div>
49    </td>
50</tr>
51