xref: /webtrees/resources/views/record-page-menu-clipboard.phtml (revision 0f5fd22fb1857ad87285e5357592434d47b1f3bf)
1<?php
2
3use Fisharebest\Webtrees\Fact;
4use Fisharebest\Webtrees\GedcomRecord;
5use Fisharebest\Webtrees\Http\RequestHandlers\PasteFact;
6use Fisharebest\Webtrees\I18N;
7use Illuminate\Support\Collection;
8
9/**
10 * @var Collection<Fact> $clipboard_facts
11 * @var GedcomRecord     $record
12 */
13
14?>
15
16<div class="dropdown-header">
17    <?= I18N::translate('Add from clipboard') ?>
18</div>
19
20<?php foreach ($clipboard_facts as $fact) : ?>
21    <form method="post" class="form-inline dropdown-item" action="<?= route(PasteFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()]) ?>">
22        <?= view('icons/copy') ?>
23        <input type="hidden" name="fact_id" value="<?= e($fact->id()) ?>">
24        <button type="submit" class="btn btn-text p-0" style="max-width:10rem">
25            <?= csrf_field() ?>
26            <?= $fact->label() ?>
27            <?php if ($fact->target() !== null) : ?>
28<?= strip_tags($fact->target()->fullName()) ?>
29            <?php elseif ($fact->value() !== '') : ?>
30<?= e($fact->value()) ?>
31            <?php endif ?>
32            <?php if ($fact->date()->isOK()) : ?>
33<?= $fact->date()->minimumDate()->format('%Y') ?>
34            <?php endif ?>
35            <?php if ($fact->place()->gedcomName() !== '') : ?>
36<?= $fact->place()->shortName() ?>
37            <?php endif ?>
38        </button>
39    </form>
40<?php endforeach ?>
41