1<?php 2 3use Fisharebest\Webtrees\GedcomRecord; 4use Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact; 5use Fisharebest\Webtrees\Http\RequestHandlers\SelectNewFact; 6use Fisharebest\Webtrees\I18N; 7 8/** 9 * @var array<string,string> $add_facts 10 * @var array<string,string> $quick_facts 11 * @var GedcomRecord $record 12 */ 13 14?> 15 16<tr> 17 <th scope="row"> 18 <label for="add-fact"> 19 <?= I18N::translate('Add a fact') ?> 20 </label> 21 </th> 22 <td> 23 <?php if ($add_facts !== []) : ?> 24 <form method="post" action="<?= e(route(SelectNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>" onsubmit="if ($('#add-fact').val() === null) {event.preventDefault();}"> 25 <?= csrf_field() ?> 26 27 <div class="input-group"> 28 <select class="form-control" 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 </form> 42 <?php endif ?> 43 44 <div class="wt-quick-facts"> 45 <?php foreach ($quick_facts as $fact => $label) : ?> 46 <a class="btn btn-link wt-quick-fact" href="<?= e(route(AddNewFact::class, [ 47 'fact' => $fact, 48 'xref' => $record->xref(), 49 'tree' => $record->tree()->name(), 50 ])) ?>"> 51 <?= $label ?> 52 </a> 53 <?php endforeach ?> 54 </div> 55 </td> 56</tr> 57