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