149a243cbSGreg Roach<?php 23976b470SGreg Roach 349a243cbSGreg Roach/** 449a243cbSGreg Roach * webtrees: online genealogy 549a243cbSGreg Roach * Copyright (C) 2019 webtrees development team 649a243cbSGreg Roach * This program is free software: you can redistribute it and/or modify 749a243cbSGreg Roach * it under the terms of the GNU General Public License as published by 849a243cbSGreg Roach * the Free Software Foundation, either version 3 of the License, or 949a243cbSGreg Roach * (at your option) any later version. 1049a243cbSGreg Roach * This program is distributed in the hope that it will be useful, 1149a243cbSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 1249a243cbSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1349a243cbSGreg Roach * GNU General Public License for more details. 1449a243cbSGreg Roach * You should have received a copy of the GNU General Public License 1549a243cbSGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 1649a243cbSGreg Roach */ 17*fcfa147eSGreg Roach 1849a243cbSGreg Roachdeclare(strict_types=1); 1949a243cbSGreg Roach 2049a243cbSGreg Roachnamespace Fisharebest\Webtrees\Module; 2149a243cbSGreg Roach 228eaf8709SGreg Roachuse Illuminate\Support\Collection; 238eaf8709SGreg Roach 2449a243cbSGreg Roach/** 2549a243cbSGreg Roach * Trait ModuleTabTrait - default implementation of ModuleTabInterface 2649a243cbSGreg Roach */ 2749a243cbSGreg Roachtrait ModuleTabTrait 2849a243cbSGreg Roach{ 2949a243cbSGreg Roach /** @var int The default position for this tab. It can be changed in the control panel. */ 30fb7a0427SGreg Roach protected $tab_order; 3149a243cbSGreg Roach 3249a243cbSGreg Roach /** 33e284d69fSGreg Roach * @return string 34e284d69fSGreg Roach */ 35e284d69fSGreg Roach abstract public function title(): string; 36e284d69fSGreg Roach 37e284d69fSGreg Roach /** 3839402588SGreg Roach * The text that appears on the tab. 3939402588SGreg Roach * 4039402588SGreg Roach * @return string 4139402588SGreg Roach */ 4239402588SGreg Roach public function tabTitle(): string 4339402588SGreg Roach { 4439402588SGreg Roach return $this->title(); 4539402588SGreg Roach } 4639402588SGreg Roach 4739402588SGreg Roach /** 4849a243cbSGreg Roach * Users change change the order of tabs using the control panel. 4949a243cbSGreg Roach * 5049a243cbSGreg Roach * @param int $tab_order 5149a243cbSGreg Roach * 5249a243cbSGreg Roach * @return void 5349a243cbSGreg Roach */ 5449a243cbSGreg Roach public function setTabOrder(int $tab_order): void 5549a243cbSGreg Roach { 5649a243cbSGreg Roach $this->tab_order = $tab_order; 5749a243cbSGreg Roach } 5849a243cbSGreg Roach 5949a243cbSGreg Roach /** 6049a243cbSGreg Roach * Users change change the order of tabs using the control panel. 6149a243cbSGreg Roach * 6249a243cbSGreg Roach * @return int 6349a243cbSGreg Roach */ 6449a243cbSGreg Roach public function getTabOrder(): int 6549a243cbSGreg Roach { 6624bd2cf5SGreg Roach return $this->tab_order ?? $this->defaultTabOrder(); 6749a243cbSGreg Roach } 6849a243cbSGreg Roach 6949a243cbSGreg Roach /** 7049a243cbSGreg Roach * The default position for this tab. It can be changed in the control panel. 7149a243cbSGreg Roach * 7249a243cbSGreg Roach * @return int 7349a243cbSGreg Roach */ 74cbf4b7faSGreg Roach public function defaultTabOrder(): int 75cbf4b7faSGreg Roach { 7649a243cbSGreg Roach return 9999; 7749a243cbSGreg Roach } 788eaf8709SGreg Roach 798eaf8709SGreg Roach /** 808eaf8709SGreg Roach * This module handles the following facts - so don't show them on the "Facts and events" tab. 818eaf8709SGreg Roach * 8254c7f8dfSGreg Roach * @return Collection 838eaf8709SGreg Roach */ 848eaf8709SGreg Roach public function supportedFacts(): Collection 858eaf8709SGreg Roach { 868eaf8709SGreg Roach return new Collection([]); 878eaf8709SGreg Roach } 8849a243cbSGreg Roach} 89