xref: /webtrees/app/Module/ModuleInterface.php (revision 26684e686fb5ab50ecb57e7e6c6a0a55852d2203)
1027c6af4SGreg Roach<?php
2027c6af4SGreg Roach/**
3027c6af4SGreg Roach * webtrees: online genealogy
48fcd0d32SGreg Roach * Copyright (C) 2019 webtrees development team
5027c6af4SGreg Roach * This program is free software: you can redistribute it and/or modify
6027c6af4SGreg Roach * it under the terms of the GNU General Public License as published by
7027c6af4SGreg Roach * the Free Software Foundation, either version 3 of the License, or
8027c6af4SGreg Roach * (at your option) any later version.
9027c6af4SGreg Roach * This program is distributed in the hope that it will be useful,
10027c6af4SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
11027c6af4SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12027c6af4SGreg Roach * GNU General Public License for more details.
13027c6af4SGreg Roach * You should have received a copy of the GNU General Public License
14027c6af4SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
15027c6af4SGreg Roach */
16027c6af4SGreg Roachdeclare(strict_types=1);
17027c6af4SGreg Roach
18027c6af4SGreg Roachnamespace Fisharebest\Webtrees\Module;
19027c6af4SGreg Roach
2049a243cbSGreg Roachuse Fisharebest\Webtrees\Tree;
2149a243cbSGreg Roach
22027c6af4SGreg Roach/**
23027c6af4SGreg Roach * Interface ModuleInterface - Classes and libraries for module system
24027c6af4SGreg Roach */
25027c6af4SGreg Roachinterface ModuleInterface
26027c6af4SGreg Roach{
27027c6af4SGreg Roach    /**
2849a243cbSGreg Roach     * A unique internal name for this module (based on the installation folder).
29027c6af4SGreg Roach     *
3049a243cbSGreg Roach     * @param string $name
3149a243cbSGreg Roach     *
3249a243cbSGreg Roach     * @return self
33027c6af4SGreg Roach     */
3449a243cbSGreg Roach    public function setName(string $name): self;
3549a243cbSGreg Roach
3649a243cbSGreg Roach    /**
3749a243cbSGreg Roach     * A unique internal name for this module (based on the installation folder).
3849a243cbSGreg Roach     *
3949a243cbSGreg Roach     * @return string
4049a243cbSGreg Roach     */
41*26684e68SGreg Roach    public function name(): string;
4249a243cbSGreg Roach
4349a243cbSGreg Roach    /**
4449a243cbSGreg Roach     * Has the module been disabled in the control panel?
4549a243cbSGreg Roach     *
4649a243cbSGreg Roach     * @param bool $enabled
4749a243cbSGreg Roach     *
4849a243cbSGreg Roach     * @return self
4949a243cbSGreg Roach     */
5049a243cbSGreg Roach    public function setEnabled(bool $enabled): self;
5149a243cbSGreg Roach
5249a243cbSGreg Roach    /**
5349a243cbSGreg Roach     * Has the module been disabled in the control panel?
5449a243cbSGreg Roach     *
5549a243cbSGreg Roach     * @return bool
5649a243cbSGreg Roach     */
5749a243cbSGreg Roach    public function isEnabled(): bool;
58027c6af4SGreg Roach
59027c6af4SGreg Roach    /**
60027c6af4SGreg Roach     * How should this module be labelled on tabs, menus, etc.?
61027c6af4SGreg Roach     *
62027c6af4SGreg Roach     * @return string
63027c6af4SGreg Roach     */
6449a243cbSGreg Roach    public function title(): string;
65027c6af4SGreg Roach
66027c6af4SGreg Roach    /**
67027c6af4SGreg Roach     * A sentence describing what this module does.
68027c6af4SGreg Roach     *
69027c6af4SGreg Roach     * @return string
70027c6af4SGreg Roach     */
7149a243cbSGreg Roach    public function description(): string;
72027c6af4SGreg Roach
73027c6af4SGreg Roach    /**
7449a243cbSGreg Roach     * Get a the current access level for a module
75027c6af4SGreg Roach     *
7649a243cbSGreg Roach     * @param Tree   $tree
7749a243cbSGreg Roach     * @param string $component tab, block, menu, etc
78027c6af4SGreg Roach     *
7949a243cbSGreg Roach     * @return int
80027c6af4SGreg Roach     */
8149a243cbSGreg Roach    public function accessLevel(Tree $tree, string $component): int;
82027c6af4SGreg Roach}
83