xref: /webtrees/resources/views/edit/raw-gedcom-fact.phtml (revision f7cf8a155e2743f3d124eef3d30a558ab062fa4b)
1<?php
2
3use Fisharebest\Webtrees\Fact;
4use Fisharebest\Webtrees\Http\RequestHandlers\EditRawFactAction;
5use Fisharebest\Webtrees\I18N;
6use Fisharebest\Webtrees\Tree;
7use Fisharebest\Webtrees\Webtrees;
8
9/**
10 * @var Fact        $fact
11 * @var string      $title
12 * @var string|null $url
13 */
14
15?>
16
17<h2 class="wt-page-title"><?= $title ?></h2>
18
19<form method="post" action="<?= e(route(EditRawFactAction::class, ['tree' => $fact->record()->tree()->name(), 'xref' => $fact->record()->xref(), 'fact_id' => $fact->id()])) ?>" class="wt-page-content">
20    <?= csrf_field() ?>
21    <input type="hidden" name="url" value="<?= e($url ?? $fact->record()->url()) ?>">
22
23    <p class="text-muted small">
24        <?= I18N::translate('This page allows you to bypass the usual forms, and edit the underlying data directly. It is an advanced option, and you should not use it unless you understand the GEDCOM format. If you make a mistake here, it can be difficult to fix.') ?>
25    </p>
26    <p class="text-muted small">
27        <?= /* I18N: %s is a URL */ I18N::translate('You can download a copy of the GEDCOM specification from %s.', '<a href="' . e(Webtrees::GEDCOM_PDF) . '">' . e(Webtrees::GEDCOM_PDF) . '</a>') ?>
28    </p>
29
30    <div class="card my-2">
31        <label class="card-header py-1 px-2 d-flex" for="gedcom">
32            <?= $fact->summary() ?>
33        </label>
34        <textarea class="card-body form-control py-1 px-2" id="gedcom" name="gedcom" rows="<?= 5 + preg_match_all('/\n/', $fact->gedcom()) ?>" dir="ltr"><?= e($fact->gedcom()) ?></textarea>
35    </div>
36
37    <div class="row form-group">
38        <div class="col-sm-9 offset-sm-3">
39            <button class="btn btn-primary" type="submit">
40                <?= view('icons/save') ?>
41                <?= /* I18N: A button label. */ I18N::translate('save') ?>
42            </button>
43            <a class="btn btn-secondary" href="<?= e($fact->record()->url()) ?>">
44                <?= view('icons/cancel') ?>
45                <?= /* I18N: A button label. */ I18N::translate('cancel') ?>
46            </a>
47        </div>
48    </div>
49</form>
50
51