xref: /webtrees/resources/views/modules/stories/tab.phtml (revision 9d74ed0ab3ae61aa8ae07578e026f14020844ce9)
1<?php
2
3declare(strict_types=1);
4
5use Fisharebest\Webtrees\I18N;
6use Fisharebest\Webtrees\Individual;
7use Fisharebest\Webtrees\Tree;
8
9/**
10 * @var bool          $is_admin
11 * @var Individual    $individual
12 * @var array<object> $stories
13 * @var Tree          $tree
14 */
15
16?>
17
18<div class="wt-tab-stories">
19    <?php foreach ($stories as $story) : ?>
20        <div class="wt-story-title text-center">
21            <h3><?= e($story->title) ?></h3>
22        </div>
23        <div class="wt-story-body">
24            <p><?= $story->story_body ?></p>
25        </div>
26        <?php if ($is_admin) : ?>
27            <p class="wt-story-edit-link">
28                <a href="<?= e(route('module', ['module' => 'stories', 'action' => 'AdminEdit', 'block_id' => $story->block_id, 'tree' => $tree->name(), 'url' => $individual->url()])) ?>">
29                    <?= I18N::translate('Edit the story') ?>
30                </a>
31            </p>
32        <?php endif ?>
33    <?php endforeach ?>
34
35    <?php if ($is_admin && $stories === []) : ?>
36        <p class="wt-story-add-link">
37            <a href="<?= e(route('module', ['module' => 'stories', 'action' => 'AdminEdit', 'xref' => $individual->xref(), 'tree' => $tree->name(), 'url' => $individual->url()])) ?>">
38                <?= I18N::translate('Add a story') ?>
39            </a>
40        </p>
41    <?php endif ?>
42</div>
43