xref: /webtrees/app/Module/FamilyNavigatorModule.php (revision 7413816e6dd2d50e569034fb804f3dce7471bb94)
18c2e8227SGreg Roach<?php
23976b470SGreg Roach
38c2e8227SGreg Roach/**
48c2e8227SGreg Roach * webtrees: online genealogy
5*d11be702SGreg Roach * Copyright (C) 2023 webtrees development team
68c2e8227SGreg Roach * This program is free software: you can redistribute it and/or modify
78c2e8227SGreg Roach * it under the terms of the GNU General Public License as published by
88c2e8227SGreg Roach * the Free Software Foundation, either version 3 of the License, or
98c2e8227SGreg Roach * (at your option) any later version.
108c2e8227SGreg Roach * This program is distributed in the hope that it will be useful,
118c2e8227SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
128c2e8227SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
138c2e8227SGreg Roach * GNU General Public License for more details.
148c2e8227SGreg Roach * You should have received a copy of the GNU General Public License
1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
168c2e8227SGreg Roach */
17fcfa147eSGreg Roach
18e7f56f2aSGreg Roachdeclare(strict_types=1);
19e7f56f2aSGreg Roach
2076692c8bSGreg Roachnamespace Fisharebest\Webtrees\Module;
2176692c8bSGreg Roach
220e62c4b8SGreg Roachuse Fisharebest\Webtrees\I18N;
230e62c4b8SGreg Roachuse Fisharebest\Webtrees\Individual;
248c2e8227SGreg Roach
258c2e8227SGreg Roach/**
268c2e8227SGreg Roach * Class FamilyNavigatorModule
278c2e8227SGreg Roach */
2837eb8894SGreg Roachclass FamilyNavigatorModule extends AbstractModule implements ModuleSidebarInterface
29c1010edaSGreg Roach{
3049a243cbSGreg Roach    use ModuleSidebarTrait;
3149a243cbSGreg Roach
32961ec755SGreg Roach    /**
330cfd6963SGreg Roach     * How should this module be identified in the control panel, etc.?
34961ec755SGreg Roach     *
35961ec755SGreg Roach     * @return string
36961ec755SGreg Roach     */
3749a243cbSGreg Roach    public function title(): string
38c1010edaSGreg Roach    {
39bbb76c12SGreg Roach        /* I18N: Name of a module/sidebar */
40bbb76c12SGreg Roach        return I18N::translate('Family navigator');
418c2e8227SGreg Roach    }
428c2e8227SGreg Roach
4349a243cbSGreg Roach    public function description(): string
44c1010edaSGreg Roach    {
45bbb76c12SGreg Roach        /* I18N: Description of the “Family navigator” module */
46bbb76c12SGreg Roach        return I18N::translate('A sidebar showing an individual’s close families and relatives.');
478c2e8227SGreg Roach    }
488c2e8227SGreg Roach
4949a243cbSGreg Roach    /**
5049a243cbSGreg Roach     * The default position for this sidebar.  It can be changed in the control panel.
5149a243cbSGreg Roach     *
5249a243cbSGreg Roach     * @return int
5349a243cbSGreg Roach     */
548f53f488SRico Sonntag    public function defaultSidebarOrder(): int
55c1010edaSGreg Roach    {
56353b36abSGreg Roach        return 2;
578c2e8227SGreg Roach    }
588c2e8227SGreg Roach
590dcd9387SGreg Roach    /**
600dcd9387SGreg Roach     * @param Individual $individual
610dcd9387SGreg Roach     *
620dcd9387SGreg Roach     * @return bool
630dcd9387SGreg Roach     */
648f53f488SRico Sonntag    public function hasSidebarContent(Individual $individual): bool
65c1010edaSGreg Roach    {
6638a9583bSGreg Roach        return true;
678c2e8227SGreg Roach    }
688c2e8227SGreg Roach
6976692c8bSGreg Roach    /**
7076692c8bSGreg Roach     * Load this sidebar synchronously.
7176692c8bSGreg Roach     *
72225e381fSGreg Roach     * @param Individual $individual
73225e381fSGreg Roach     *
7476692c8bSGreg Roach     * @return string
7576692c8bSGreg Roach     */
768f53f488SRico Sonntag    public function getSidebarContent(Individual $individual): string
77c1010edaSGreg Roach    {
78a8cd57e1SGreg Roach        return view('modules/family_nav/sidebar', ['individual' => $individual]);
798c2e8227SGreg Roach    }
808c2e8227SGreg Roach}
81