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