xref: /webtrees/resources/views/layouts/default.phtml (revision cacefda1879a630cb123d4cd92f434ddbcc1f10e)
1<?php
2
3use Fisharebest\Webtrees\DebugBar;
4use Fisharebest\Webtrees\FlashMessages;
5use Fisharebest\Webtrees\Http\RequestHandlers\SearchQuickAction;
6use Fisharebest\Webtrees\I18N;
7use Fisharebest\Webtrees\Module\ModuleFooterInterface;
8use Fisharebest\Webtrees\Module\ModuleGlobalInterface;
9use Fisharebest\Webtrees\Module\ModuleThemeInterface;
10use Fisharebest\Webtrees\Services\ModuleService;
11use Fisharebest\Webtrees\View;
12use Fisharebest\Webtrees\Webtrees;
13use Psr\Http\Message\ServerRequestInterface;
14
15/**
16 * @var string $title
17 * @var string $content
18 */
19
20$language_tag = app(ServerRequestInterface::class)->getAttribute('locale')->languageTag();
21?>
22
23<!DOCTYPE html>
24<html dir="<?= I18N::direction() ?>" lang="<?= e($language_tag) ?>">
25    <head>
26        <meta charset="UTF-8">
27        <meta name="csrf" content="<?= e(csrf_token()) ?>">
28        <meta name="viewport" content="width=device-width, initial-scale=1">
29        <meta name="robots" content="<?= e($meta_robots ?? 'noindex') ?>">
30        <meta name="generator" content="<?= e(Webtrees::NAME) ?> <?= e(Webtrees::VERSION) ?>">
31        <?php if ($tree !== null) : ?>
32            <meta name="description" content="<?= e($tree->getPreference('META_DESCRIPTION')) ?>">
33        <?php endif ?>
34
35        <title>
36            <?= strip_tags($title) ?>
37            <?php if ($tree !== null && $tree->getPreference('META_TITLE') !== '') : ?>
38<?= e($tree->getPreference('META_TITLE')) ?>
39            <?php endif ?>
40        </title>
41
42        <!--Generic favicons-->
43        <link rel="icon" sizes="32x32" href="<?= e(asset('favicon-32.png')) ?>">
44        <link rel="icon" sizes="57x57" href="<?= e(asset('favicon-57.png')) ?>">
45        <link rel="icon" sizes="76x76" href="<?= e(asset('favicon-76.png')) ?>">
46        <link rel="icon" sizes="96x96" href="<?= e(asset('favicon-96.png')) ?>">
47        <link rel="icon" sizes="128x128" href="<?= e(asset('favicon-128.png')) ?>">
48        <link rel="icon" sizes="192x192" href="<?= e(asset('favicon-192.png')) ?>">
49        <!--Android-->
50        <link rel="shortcut icon" sizes="196x196" href="<?= e(asset('favicon-196.png')) ?>">
51        <!--iOS-->
52        <link rel="apple-touch-icon" sizes="120x120" href="<?= e(asset('favicon-120.png')) ?>">
53        <link rel="apple-touch-icon" sizes="152x152" href="<?= e(asset('favicon-152.png')) ?>">
54        <link rel="apple-touch-icon" sizes="180x180" href="<?= e(asset('favicon-180.png')) ?>">
55        <!--Windows 8 IE 10-->
56        <meta name="msapplication-TileColor" content="#FFFFFF">
57        <meta name="msapplication-TileImage" content="<?= e(asset('favicon-144.png')) ?>">
58        <!--Windows 8.1 + IE11 and above-->
59        <meta name="msapplication-config" content="<?= e(asset('browserconfig.xml')) ?>">
60
61        <link rel="manifest" href="<?= e(asset('site.webmanifest')) ?>">
62
63        <link rel="stylesheet" href="<?= e(asset('css/vendor.min.css')) ?>">
64        <?php foreach (app(ModuleThemeInterface::class)->stylesheets() as $stylesheet) : ?>
65            <link rel="stylesheet" href="<?= e($stylesheet) ?>">
66        <?php endforeach ?>
67
68        <?= View::stack('styles') ?>
69
70        <?= app(ModuleService::class)->findByInterface(ModuleGlobalInterface::class)->map(static function (ModuleGlobalInterface $module): string { return $module->headContent(); })->implode('') ?>
71
72        <?= DebugBar::renderHead() ?>
73    </head>
74
75    <body class="wt-global wt-theme-<?= e(app(ModuleThemeInterface::class)->name()) ?> wt-route-<?= e(app(ServerRequestInterface::class)->getAttribute('route')) ?>">
76        <header class="wt-header-wrapper d-print-none">
77            <div class="container wt-header-container">
78                <div class="row wt-header-content">
79                    <div class="wt-accessibility-links position-fixed">
80                        <a class="sr-only sr-only-focusable btn btn-info btn-sm" href="#content">
81                            <?= /* I18N: Skip over the headers and menus, to the main content of the page */
82                            I18N::translate('Skip to content') ?>
83                        </a>
84                    </div>
85                    <div class="col wt-site-logo"></div>
86
87                    <?php if ($tree !== null) : ?>
88                        <h1 class="col wt-site-title"><?= e($tree->title()) ?></h1>
89
90                        <div class="col wt-header-search">
91                            <form method="post" action="<?= e(route(SearchQuickAction::class, ['tree' => $tree->name()])) ?>" class="wt-header-search-form" role="search">
92                                <?= csrf_field() ?>
93                                <div class="input-group">
94                                    <label class="sr-only" for="quick-search"><?= I18N::translate('Search') ?></label>
95                                    <input type="search" class="form-control wt-header-search-field" id="quick-search" name="query" size="15" placeholder="<?= I18N::translate('Search') ?>">
96                                    <div class="input-group-append">
97                                        <button type="submit" class="btn btn-primary wt-header-search-button">
98                                            <?= view('icons/search') ?>
99                                        </button>
100                                    </div>
101                                </div>
102                            </form>
103                        </div>
104                    <?php endif ?>
105
106                    <div class="col wt-secondary-navigation">
107                        <ul class="nav wt-user-menu">
108                            <?php foreach (app(ModuleThemeInterface::class)->userMenu($tree) as $menu) : ?>
109                                <?= $menu->bootstrap4() ?>
110                            <?php endforeach ?>
111                        </ul>
112                    </div>
113
114                    <?php if ($tree !== null) : ?>
115                        <nav class="col wt-primary-navigation">
116                            <ul class="nav wt-genealogy-menu">
117                                <?php foreach (app(ModuleThemeInterface::class)->genealogyMenu($tree) as $menu) : ?>
118                                    <?= $menu->bootstrap4() ?>
119                                <?php endforeach ?>
120                            </ul>
121                        </nav>
122                    <?php endif ?>
123                </div>
124            </div>
125        </header>
126
127        <main id="content" class="wt-main-wrapper">
128            <div class="container wt-main-container">
129                <div class="flash-messages">
130                    <?php foreach (FlashMessages::getMessages() as $message) : ?>
131                        <div class="alert alert-<?= e($message->status) ?> alert-dismissible" role="alert">
132                            <button type="button" class="close" data-dismiss="alert" aria-label="<?= I18N::translate('close') ?>">
133                                <span aria-hidden="true">&times;</span>
134                            </button>
135                            <?= $message->text ?>
136                        </div>
137                    <?php endforeach ?>
138                </div>
139
140                <?= $content ?>
141            </div>
142        </main>
143
144        <footer class="wt-footers container d-print-none">
145            <?= app(ModuleService::class)->findByInterface(ModuleFooterInterface::class)->map(static function (ModuleFooterInterface $module) use ($request): string { return $module->getFooter($request); })->implode('') ?>
146        </footer>
147
148        <script src="<?= e(asset('js/vendor.min.js')) ?>"></script>
149        <script src="<?= e(asset('js/webtrees.min.js')) ?>"></script>
150
151        <script>
152            activate_colorbox();
153            jQuery.extend(jQuery.colorbox.settings, {
154                width:          "85%",
155                height:         "85%",
156                transition:     "none",
157                slideshowStart: "<?= I18N::translate('Play') ?>",
158                slideshowStop:  "<?= I18N::translate('Stop') ?>",
159                title:          function () {
160                    return this.dataset.title;
161                },
162            });
163        </script>
164
165        <?= View::stack('javascript') ?>
166
167        <?= app(ModuleService::class)->findByInterface(ModuleGlobalInterface::class)->map(static function (ModuleGlobalInterface $module): string { return $module->bodyContent(); })->implode('') ?>
168
169        <?= DebugBar::render() ?>
170    </body>
171</html>
172