xref: /webtrees/app/Module/FamilyNavigatorModule.php (revision 0cfd6963ac65bd7fe86283b801b4f23d665c6004)
18c2e8227SGreg Roach<?php
28c2e8227SGreg Roach/**
38c2e8227SGreg Roach * webtrees: online genealogy
48fcd0d32SGreg Roach * Copyright (C) 2019 webtrees development team
58c2e8227SGreg Roach * This program is free software: you can redistribute it and/or modify
68c2e8227SGreg Roach * it under the terms of the GNU General Public License as published by
78c2e8227SGreg Roach * the Free Software Foundation, either version 3 of the License, or
88c2e8227SGreg Roach * (at your option) any later version.
98c2e8227SGreg Roach * This program is distributed in the hope that it will be useful,
108c2e8227SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
118c2e8227SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
128c2e8227SGreg Roach * GNU General Public License for more details.
138c2e8227SGreg Roach * You should have received a copy of the GNU General Public License
148c2e8227SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
158c2e8227SGreg Roach */
16e7f56f2aSGreg Roachdeclare(strict_types=1);
17e7f56f2aSGreg Roach
1876692c8bSGreg Roachnamespace Fisharebest\Webtrees\Module;
1976692c8bSGreg Roach
200e62c4b8SGreg Roachuse Fisharebest\Webtrees\I18N;
210e62c4b8SGreg Roachuse Fisharebest\Webtrees\Individual;
228c2e8227SGreg Roach
238c2e8227SGreg Roach/**
248c2e8227SGreg Roach * Class FamilyNavigatorModule
258c2e8227SGreg Roach */
2637eb8894SGreg Roachclass FamilyNavigatorModule extends AbstractModule implements ModuleSidebarInterface
27c1010edaSGreg Roach{
2849a243cbSGreg Roach    use ModuleSidebarTrait;
2949a243cbSGreg Roach
30961ec755SGreg Roach    /**
31*0cfd6963SGreg Roach     * How should this module be identified in the control panel, etc.?
32961ec755SGreg Roach     *
33961ec755SGreg Roach     * @return string
34961ec755SGreg Roach     */
3549a243cbSGreg Roach    public function title(): string
36c1010edaSGreg Roach    {
37bbb76c12SGreg Roach        /* I18N: Name of a module/sidebar */
38bbb76c12SGreg Roach        return I18N::translate('Family navigator');
398c2e8227SGreg Roach    }
408c2e8227SGreg Roach
41961ec755SGreg Roach    /**
42961ec755SGreg Roach     * A sentence describing what this module does.
43961ec755SGreg Roach     *
44961ec755SGreg Roach     * @return string
45961ec755SGreg Roach     */
4649a243cbSGreg Roach    public function description(): string
47c1010edaSGreg Roach    {
48bbb76c12SGreg Roach        /* I18N: Description of the “Family navigator” module */
49bbb76c12SGreg Roach        return I18N::translate('A sidebar showing an individual’s close families and relatives.');
508c2e8227SGreg Roach    }
518c2e8227SGreg Roach
5249a243cbSGreg Roach    /**
5349a243cbSGreg Roach     * The default position for this sidebar.  It can be changed in the control panel.
5449a243cbSGreg Roach     *
5549a243cbSGreg Roach     * @return int
5649a243cbSGreg Roach     */
578f53f488SRico Sonntag    public function defaultSidebarOrder(): int
58c1010edaSGreg Roach    {
59353b36abSGreg Roach        return 2;
608c2e8227SGreg Roach    }
618c2e8227SGreg Roach
628c2e8227SGreg Roach    /** {@inheritdoc} */
638f53f488SRico Sonntag    public function hasSidebarContent(Individual $individual): bool
64c1010edaSGreg Roach    {
6538a9583bSGreg Roach        return true;
668c2e8227SGreg Roach    }
678c2e8227SGreg Roach
6876692c8bSGreg Roach    /**
6976692c8bSGreg Roach     * Load this sidebar synchronously.
7076692c8bSGreg Roach     *
71225e381fSGreg Roach     * @param Individual $individual
72225e381fSGreg Roach     *
7376692c8bSGreg Roach     * @return string
7476692c8bSGreg Roach     */
758f53f488SRico Sonntag    public function getSidebarContent(Individual $individual): string
76c1010edaSGreg Roach    {
77a8cd57e1SGreg Roach        return view('modules/family_nav/sidebar', ['individual' => $individual]);
788c2e8227SGreg Roach    }
798c2e8227SGreg Roach}
80