1<?php 2 3use Fisharebest\Webtrees\Family; 4use Fisharebest\Webtrees\GedcomRecord; 5use Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact; 6use Fisharebest\Webtrees\Http\RequestHandlers\SelectNewFact; 7use Fisharebest\Webtrees\I18N; 8use Fisharebest\Webtrees\Individual; 9use Fisharebest\Webtrees\Registry; 10 11/** 12 * @var array<string,string> $add_facts 13 * @var array<string,string> $quick_facts 14 * @var GedcomRecord $record 15 */ 16 17?> 18 19<tr> 20 <th scope="row"> 21 <label for="add-fact"> 22 <?= I18N::translate('Fact or event') ?> 23 </label> 24 </th> 25 <td> 26 <form method="post" action="<?= e(route(SelectNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>" onsubmit="if ($('#add-fact').val() === null) {event.preventDefault();}"> 27 <?= csrf_field() ?> 28 29 <div class="input-group"> 30 <select class="custom-select" id="add-fact" name="fact"> 31 <option value="" disabled selected> 32 <?= I18N::translate('<select>') ?> 33 </option> 34 <?php foreach ($add_facts as $fact => $fact_name) : ?> 35 <option value="<?= $fact ?>"><?= $fact_name ?></option> 36 <?php endforeach ?> 37 <?php if ($record->tag() === Individual::RECORD_TYPE || $record->tag() === Family::RECORD_TYPE) : ?> 38 <option value="FACT"> 39 <?= I18N::translate('Custom fact') ?> 40 </option> 41 <option value="EVEN"> 42 <?= I18N::translate('Custom event') ?> 43 </option> 44 <?php endif ?> 45 </select> 46 <div class="input-group-append"> 47 <button class="btn btn-light" type="submit"> 48 <?= /* I18N: A button label. */ I18N::translate('add') ?> 49 </button> 50 </div> 51 </div> 52 </form> 53 54 <div class="wt-quick-facts"> 55 <?php foreach ($quick_facts as $fact) : ?> 56 <a class="btn btn-link btn-sm wt-quick-fact" href="<?= e(route(AddNewFact::class, [ 57 'fact' => $fact, 58 'xref' => $record->xref(), 59 'tree' => $record->tree()->name(), 60 ])) ?>"> 61 <?= Registry::elementFactory()->make($record->tag() . ':' . $fact)->label() ?> 62 </a> 63 <?php endforeach ?> 64 </div> 65 </td> 66</tr> 67