1<?php 2 3declare(strict_types=1); 4 5use Fisharebest\Webtrees\GedcomRecord; 6use Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact; 7use Fisharebest\Webtrees\Http\RequestHandlers\SelectNewFact; 8use Fisharebest\Webtrees\I18N; 9 10/** 11 * @var array<string,string> $add_facts 12 * @var array<string,string> $quick_facts 13 * @var GedcomRecord $record 14 */ 15 16?> 17 18<tr> 19 <th scope="row"> 20 <label for="add-fact"> 21 <?= I18N::translate('Add a fact') ?> 22 </label> 23 </th> 24 <td> 25 <?php if ($add_facts !== []) : ?> 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 <div class="input-group"> 28 <select class="form-select" id="add-fact" name="fact"> 29 <option value="" disabled selected> 30 <?= I18N::translate('<select>') ?> 31 </option> 32 <?php foreach ($add_facts as $fact => $label) : ?> 33 <option value="<?= $fact ?>"><?= $label ?></option> 34 <?php endforeach ?> 35 </select> 36 37 <button class="btn btn-primary" type="submit"> 38 <?= /* I18N: A button label. */ I18N::translate('add') ?> 39 </button> 40 </div> 41 42 <?= csrf_field() ?> 43 </form> 44 <?php endif ?> 45 46 <div class="wt-quick-facts"> 47 <?php foreach ($quick_facts as $fact => $label) : ?> 48 <a class="btn btn-link wt-quick-fact" href="<?= e(route(AddNewFact::class, [ 49 'fact' => $fact, 50 'xref' => $record->xref(), 51 'tree' => $record->tree()->name(), 52 ])) ?>"> 53 <?= $label ?> 54 </a> 55 <?php endforeach ?> 56 </div> 57 </td> 58</tr> 59