xref: /webtrees/app/Module/ModuleTabTrait.php (revision 8eaf87094d89aefab9b38d5ab9c97e56b054593b)
149a243cbSGreg Roach<?php
249a243cbSGreg Roach/**
349a243cbSGreg Roach * webtrees: online genealogy
449a243cbSGreg Roach * Copyright (C) 2019 webtrees development team
549a243cbSGreg Roach * This program is free software: you can redistribute it and/or modify
649a243cbSGreg Roach * it under the terms of the GNU General Public License as published by
749a243cbSGreg Roach * the Free Software Foundation, either version 3 of the License, or
849a243cbSGreg Roach * (at your option) any later version.
949a243cbSGreg Roach * This program is distributed in the hope that it will be useful,
1049a243cbSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
1149a243cbSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1249a243cbSGreg Roach * GNU General Public License for more details.
1349a243cbSGreg Roach * You should have received a copy of the GNU General Public License
1449a243cbSGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
1549a243cbSGreg Roach */
1649a243cbSGreg Roachdeclare(strict_types=1);
1749a243cbSGreg Roach
1849a243cbSGreg Roachnamespace Fisharebest\Webtrees\Module;
1949a243cbSGreg Roach
20*8eaf8709SGreg Roachuse Illuminate\Support\Collection;
21*8eaf8709SGreg Roach
2249a243cbSGreg Roach/**
2349a243cbSGreg Roach * Trait ModuleTabTrait - default implementation of ModuleTabInterface
2449a243cbSGreg Roach */
2549a243cbSGreg Roachtrait ModuleTabTrait
2649a243cbSGreg Roach{
2749a243cbSGreg Roach    /** @var int The default position for this tab.  It can be changed in the control panel. */
2849a243cbSGreg Roach    protected $tab_order = 0;
2949a243cbSGreg Roach
3049a243cbSGreg Roach    /**
3149a243cbSGreg Roach     * Users change change the order of tabs using the control panel.
3249a243cbSGreg Roach     *
3349a243cbSGreg Roach     * @param int $tab_order
3449a243cbSGreg Roach     *
3549a243cbSGreg Roach     * @return void
3649a243cbSGreg Roach     */
3749a243cbSGreg Roach    public function setTabOrder(int $tab_order): void
3849a243cbSGreg Roach    {
3949a243cbSGreg Roach        $this->tab_order = $tab_order;
4049a243cbSGreg Roach    }
4149a243cbSGreg Roach
4249a243cbSGreg Roach    /**
4349a243cbSGreg Roach     * Users change change the order of tabs using the control panel.
4449a243cbSGreg Roach     *
4549a243cbSGreg Roach     * @return int
4649a243cbSGreg Roach     */
4749a243cbSGreg Roach    public function getTabOrder(): int
4849a243cbSGreg Roach    {
4924bd2cf5SGreg Roach        return $this->tab_order ?? $this->defaultTabOrder();
5049a243cbSGreg Roach    }
5149a243cbSGreg Roach
5249a243cbSGreg Roach    /**
5349a243cbSGreg Roach     * The default position for this tab.  It can be changed in the control panel.
5449a243cbSGreg Roach     *
5549a243cbSGreg Roach     * @return int
5649a243cbSGreg Roach     */
57cbf4b7faSGreg Roach    public function defaultTabOrder(): int
58cbf4b7faSGreg Roach    {
5949a243cbSGreg Roach        return 9999;
6049a243cbSGreg Roach    }
61*8eaf8709SGreg Roach
62*8eaf8709SGreg Roach    /**
63*8eaf8709SGreg Roach     * This module handles the following facts - so don't show them on the "Facts and events" tab.
64*8eaf8709SGreg Roach     *
65*8eaf8709SGreg Roach     * @return Collection|string[]
66*8eaf8709SGreg Roach     */
67*8eaf8709SGreg Roach    public function supportedFacts(): Collection
68*8eaf8709SGreg Roach    {
69*8eaf8709SGreg Roach        return new Collection([]);
70*8eaf8709SGreg Roach    }
7149a243cbSGreg Roach}
72