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 * 3237eb8894SGreg Roach * @return void 33027c6af4SGreg Roach */ 3437eb8894SGreg Roach public function setName(string $name): void; 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 */ 4126684e68SGreg 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 /** 60*888ddf4fSGreg Roach * Should this module be enabled when it is first installed? 61*888ddf4fSGreg Roach * 62*888ddf4fSGreg Roach * @return bool 63*888ddf4fSGreg Roach */ 64*888ddf4fSGreg Roach public function isEnabledByDefault(): bool; 65*888ddf4fSGreg Roach 66*888ddf4fSGreg Roach /** 67027c6af4SGreg Roach * How should this module be labelled on tabs, menus, etc.? 68027c6af4SGreg Roach * 69027c6af4SGreg Roach * @return string 70027c6af4SGreg Roach */ 7149a243cbSGreg Roach public function title(): string; 72027c6af4SGreg Roach 73027c6af4SGreg Roach /** 74027c6af4SGreg Roach * A sentence describing what this module does. 75027c6af4SGreg Roach * 76027c6af4SGreg Roach * @return string 77027c6af4SGreg Roach */ 7849a243cbSGreg Roach public function description(): string; 79027c6af4SGreg Roach 80027c6af4SGreg Roach /** 8149a243cbSGreg Roach * Get a the current access level for a module 82027c6af4SGreg Roach * 8349a243cbSGreg Roach * @param Tree $tree 8449a243cbSGreg Roach * @param string $component tab, block, menu, etc 85027c6af4SGreg Roach * 8649a243cbSGreg Roach * @return int 87027c6af4SGreg Roach */ 8849a243cbSGreg Roach public function accessLevel(Tree $tree, string $component): int; 8937eb8894SGreg Roach 9037eb8894SGreg Roach /** 9137eb8894SGreg Roach * Get a module setting. Return a default if the setting is not set. 9237eb8894SGreg Roach * 9337eb8894SGreg Roach * @param string $setting_name 9437eb8894SGreg Roach * @param string $default 9537eb8894SGreg Roach * 9637eb8894SGreg Roach * @return string 9737eb8894SGreg Roach */ 9837eb8894SGreg Roach public function getPreference(string $setting_name, string $default = ''): string; 9937eb8894SGreg Roach 10037eb8894SGreg Roach /** 10137eb8894SGreg Roach * Set a module setting. 10237eb8894SGreg Roach * 10337eb8894SGreg Roach * Since module settings are NOT NULL, setting a value to NULL will cause 10437eb8894SGreg Roach * it to be deleted. 10537eb8894SGreg Roach * 10637eb8894SGreg Roach * @param string $setting_name 10737eb8894SGreg Roach * @param string $setting_value 10837eb8894SGreg Roach * 109ea02ddf4SGreg Roach * @return void 11037eb8894SGreg Roach */ 11137eb8894SGreg Roach public function setPreference(string $setting_name, string $setting_value): void; 112027c6af4SGreg Roach} 113