xref: /webtrees/resources/views/layouts/default.phtml (revision df27497a949ee94233b78915e33f253447a14e62)
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="stylesheet" href="<?= e(asset('css/vendor.min.css')) ?>">
62        <?php foreach (app(ModuleThemeInterface::class)->stylesheets() as $stylesheet) : ?>
63            <link rel="stylesheet" href="<?= e($stylesheet) ?>">
64        <?php endforeach ?>
65
66        <?= View::stack('styles') ?>
67
68        <?= app(ModuleService::class)->findByInterface(ModuleGlobalInterface::class)->map(static function (ModuleGlobalInterface $module): string { return $module->headContent(); })->implode('') ?>
69
70        <?= DebugBar::renderHead() ?>
71    </head>
72
73    <body class="wt-global wt-theme-<?= e(app(ModuleThemeInterface::class)->name()) ?> wt-route-<?= e(app(ServerRequestInterface::class)->getAttribute('route')) ?>">
74        <header class="wt-header-wrapper d-print-none">
75            <div class="container wt-header-container">
76                <div class="row wt-header-content">
77                    <div class="wt-accessibility-links position-fixed">
78                        <a class="sr-only sr-only-focusable btn btn-info btn-sm" href="#content">
79                            <?= /* I18N: Skip over the headers and menus, to the main content of the page */
80                            I18N::translate('Skip to content') ?>
81                        </a>
82                    </div>
83                    <div class="col wt-site-logo"></div>
84
85                    <?php if ($tree !== null) : ?>
86                        <h1 class="col wt-site-title"><?= e($tree->title()) ?></h1>
87
88                        <div class="col wt-header-search">
89                            <form method="post" action="<?= e(route(SearchQuickAction::class, ['tree' => $tree->name()])) ?>" class="wt-header-search-form" role="search">
90                                <?= csrf_field() ?>
91                                <div class="input-group">
92                                    <label class="sr-only" for="quick-search"><?= I18N::translate('Search') ?></label>
93                                    <input type="search" class="form-control wt-header-search-field" id="quick-search" name="query" size="15" placeholder="<?= I18N::translate('Search') ?>">
94                                    <div class="input-group-append">
95                                        <button type="submit" class="btn btn-primary wt-header-search-button">
96                                            <?= view('icons/search') ?>
97                                        </button>
98                                    </div>
99                                </div>
100                            </form>
101                        </div>
102                    <?php endif ?>
103
104                    <div class="col wt-secondary-navigation">
105                        <ul class="nav wt-user-menu">
106                            <?php foreach (app(ModuleThemeInterface::class)->userMenu($tree) as $menu) : ?>
107                                <?= $menu->bootstrap4() ?>
108                            <?php endforeach ?>
109                        </ul>
110                    </div>
111
112                    <?php if ($tree !== null) : ?>
113                        <nav class="col wt-primary-navigation">
114                            <ul class="nav wt-genealogy-menu">
115                                <?php foreach (app(ModuleThemeInterface::class)->genealogyMenu($tree) as $menu) : ?>
116                                    <?= $menu->bootstrap4() ?>
117                                <?php endforeach ?>
118                            </ul>
119                        </nav>
120                    <?php endif ?>
121                </div>
122            </div>
123        </header>
124
125        <main id="content" class="wt-main-wrapper">
126            <div class="container wt-main-container">
127                <div class="flash-messages">
128                    <?php foreach (FlashMessages::getMessages() as $message) : ?>
129                        <div class="alert alert-<?= e($message->status) ?> alert-dismissible" role="alert">
130                            <button type="button" class="close" data-dismiss="alert" aria-label="<?= I18N::translate('close') ?>">
131                                <span aria-hidden="true">&times;</span>
132                            </button>
133                            <?= $message->text ?>
134                        </div>
135                    <?php endforeach ?>
136                </div>
137
138                <?= $content ?>
139            </div>
140        </main>
141
142        <footer class="wt-footers container d-print-none">
143            <?= app(ModuleService::class)->findByInterface(ModuleFooterInterface::class)->map(static function (ModuleFooterInterface $module) use ($request): string { return $module->getFooter($request); })->implode('') ?>
144        </footer>
145
146        <script src="<?= e(asset('js/vendor.min.js')) ?>"></script>
147        <script src="<?= e(asset('js/webtrees.min.js')) ?>"></script>
148
149        <script>
150            activate_colorbox();
151            jQuery.extend(jQuery.colorbox.settings, {
152                width:          "85%",
153                height:         "85%",
154                transition:     "none",
155                slideshowStart: "<?= I18N::translate('Play') ?>",
156                slideshowStop:  "<?= I18N::translate('Stop') ?>",
157                title:          function () {
158                    return this.dataset.title;
159                },
160            });
161        </script>
162
163        <?= View::stack('javascript') ?>
164
165        <?= app(ModuleService::class)->findByInterface(ModuleGlobalInterface::class)->map(static function (ModuleGlobalInterface $module): string { return $module->bodyContent(); })->implode('') ?>
166
167        <?= DebugBar::render() ?>
168    </body>
169</html>
170