xref: /webtrees/resources/views/edit/raw-gedcom-fact.phtml (revision 3f0247b283a74c64ac885446380ea81de9cf779e)
1<?php
2
3use Fisharebest\Webtrees\Fact;
4use Fisharebest\Webtrees\Gedcom;
5use Fisharebest\Webtrees\Http\RequestHandlers\EditRawFactAction;
6use Fisharebest\Webtrees\I18N;
7use Fisharebest\Webtrees\View;
8use Fisharebest\Webtrees\Webtrees;
9
10/**
11 * @var Fact        $fact
12 * @var string      $title
13 * @var string|null $url
14 */
15
16?>
17
18<h2 class="wt-page-title"><?= $title ?></h2>
19
20<form method="post" id="edit-raw-gedcom" action="<?= e(route(EditRawFactAction::class, ['tree' => $fact->record()->tree()->name(), 'xref' => $fact->record()->xref(), 'fact_id' => $fact->id()])) ?>" class="wt-page-content">
21    <input type="hidden" name="url" value="<?= e($url ?? $fact->record()->url()) ?>">
22
23    <div class="form-text">
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    </div>
26    <div class="form-text">
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    </div>
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" data-wt-pattern="<?= e(Gedcom::REGEX_FACT) ?>" 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 mb-3">
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
50    <?= csrf_field() ?>
51</form>
52
53<?php View::push('javascript') ?>
54<script>
55  webtrees.textareaPatterns(document.getElementById('edit-raw-gedcom'));
56</script>
57<?php View::endpush() ?>
58
59