xref: /webtrees/app/Module/ModuleTabInterface.php (revision 394025883384f51ec45db09a4c5dd2bf83fa437a)
1a25f0a04SGreg Roach<?php
2a25f0a04SGreg Roach/**
3a25f0a04SGreg Roach * webtrees: online genealogy
48fcd0d32SGreg Roach * Copyright (C) 2019 webtrees development team
5a25f0a04SGreg Roach * This program is free software: you can redistribute it and/or modify
6a25f0a04SGreg Roach * it under the terms of the GNU General Public License as published by
7a25f0a04SGreg Roach * the Free Software Foundation, either version 3 of the License, or
8a25f0a04SGreg Roach * (at your option) any later version.
9a25f0a04SGreg Roach * This program is distributed in the hope that it will be useful,
10a25f0a04SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
11a25f0a04SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12a25f0a04SGreg Roach * GNU General Public License for more details.
13a25f0a04SGreg Roach * You should have received a copy of the GNU General Public License
14a25f0a04SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
15a25f0a04SGreg Roach */
16e7f56f2aSGreg Roachdeclare(strict_types=1);
17e7f56f2aSGreg Roach
1876692c8bSGreg Roachnamespace Fisharebest\Webtrees\Module;
19c1010edaSGreg Roach
20225e381fSGreg Roachuse Fisharebest\Webtrees\Individual;
218eaf8709SGreg Roachuse Illuminate\Support\Collection;
22a25f0a04SGreg Roach
23a25f0a04SGreg Roach/**
24a25f0a04SGreg Roach * Interface ModuleTabInterface - Classes and libraries for module system
25a25f0a04SGreg Roach */
2637eb8894SGreg Roachinterface ModuleTabInterface extends ModuleInterface
27c1010edaSGreg Roach{
28*39402588SGreg Roach    /**
29*39402588SGreg Roach     * The text that appears on the tab.
30*39402588SGreg Roach     *
31*39402588SGreg Roach     * @return string
32*39402588SGreg Roach     */
33defb8071SRichard Cissée    public function tabTitle(): string;
34defb8071SRichard Cissée
35a25f0a04SGreg Roach    /**
3649a243cbSGreg Roach     * Users change change the order of tabs using the control panel.
3749a243cbSGreg Roach     *
3849a243cbSGreg Roach     * @param int $tab_order
3949a243cbSGreg Roach     *
4049a243cbSGreg Roach     * @return void
4149a243cbSGreg Roach     */
4249a243cbSGreg Roach    public function setTabOrder(int $tab_order): void;
4349a243cbSGreg Roach
4449a243cbSGreg Roach    /**
4549a243cbSGreg Roach     * Users change change the order of tabs using the control panel.
46a25f0a04SGreg Roach     *
47cbc1590aSGreg Roach     * @return int
48a25f0a04SGreg Roach     */
4949a243cbSGreg Roach    public function getTabOrder(): int;
5049a243cbSGreg Roach
5149a243cbSGreg Roach    /**
5249a243cbSGreg Roach     * The default position for this tab.  It can be changed in the control panel.
5349a243cbSGreg Roach     *
5449a243cbSGreg Roach     * @return int
5549a243cbSGreg Roach     */
56c1afbf58SGreg Roach    public function defaultTabOrder(): int;
57a25f0a04SGreg Roach
58a25f0a04SGreg Roach    /**
59a25f0a04SGreg Roach     * Generate the HTML content of this tab.
60a25f0a04SGreg Roach     *
61225e381fSGreg Roach     * @param Individual $individual
62225e381fSGreg Roach     *
63a25f0a04SGreg Roach     * @return string
64a25f0a04SGreg Roach     */
658f53f488SRico Sonntag    public function getTabContent(Individual $individual): string;
66a25f0a04SGreg Roach
67a25f0a04SGreg Roach    /**
68a25f0a04SGreg Roach     * Is this tab empty? If so, we don't always need to display it.
69cbc1590aSGreg Roach     *
70225e381fSGreg Roach     * @param Individual $individual
71225e381fSGreg Roach     *
72cbc1590aSGreg Roach     * @return bool
73a25f0a04SGreg Roach     */
748f53f488SRico Sonntag    public function hasTabContent(Individual $individual): bool;
75a25f0a04SGreg Roach
76a25f0a04SGreg Roach    /**
77a25f0a04SGreg Roach     * Can this tab load asynchronously?
78a25f0a04SGreg Roach     *
79cbc1590aSGreg Roach     * @return bool
80a25f0a04SGreg Roach     */
818f53f488SRico Sonntag    public function canLoadAjax(): bool;
82a25f0a04SGreg Roach
83a25f0a04SGreg Roach    /**
84a25f0a04SGreg Roach     * A greyed out tab has no actual content, but may perhaps have
85a25f0a04SGreg Roach     * options to create content.
86a25f0a04SGreg Roach     *
87225e381fSGreg Roach     * @param Individual $individual
88225e381fSGreg Roach     *
89cbc1590aSGreg Roach     * @return bool
90a25f0a04SGreg Roach     */
918f53f488SRico Sonntag    public function isGrayedOut(Individual $individual): bool;
928eaf8709SGreg Roach
938eaf8709SGreg Roach    /**
948eaf8709SGreg Roach     * This module handles the following facts - so don't show them on the "Facts and events" tab.
958eaf8709SGreg Roach     *
968eaf8709SGreg Roach     * @return Collection|string[]
978eaf8709SGreg Roach     */
988eaf8709SGreg Roach    public function supportedFacts(): Collection;
99a25f0a04SGreg Roach}
100