xref: /webtrees/app/Module/ModuleFooterTrait.php (revision 33c343964203a24deeb34413eac7f48bee172865)
1*33c34396SGreg Roach<?php
2*33c34396SGreg Roach/**
3*33c34396SGreg Roach * webtrees: online genealogy
4*33c34396SGreg Roach * Copyright (C) 2019 webtrees development team
5*33c34396SGreg Roach * This program is free software: you can redistribute it and/or modify
6*33c34396SGreg Roach * it under the terms of the GNU General Public License as published by
7*33c34396SGreg Roach * the Free Software Foundation, either version 3 of the License, or
8*33c34396SGreg Roach * (at your option) any later version.
9*33c34396SGreg Roach * This program is distributed in the hope that it will be useful,
10*33c34396SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
11*33c34396SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12*33c34396SGreg Roach * GNU General Public License for more details.
13*33c34396SGreg Roach * You should have received a copy of the GNU General Public License
14*33c34396SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
15*33c34396SGreg Roach */
16*33c34396SGreg Roachdeclare(strict_types=1);
17*33c34396SGreg Roach
18*33c34396SGreg Roachnamespace Fisharebest\Webtrees\Module;
19*33c34396SGreg Roach
20*33c34396SGreg Roach/**
21*33c34396SGreg Roach * Trait ModuleFooterTrait - default implementation of ModuleFooterInterface
22*33c34396SGreg Roach */
23*33c34396SGreg Roachtrait ModuleFooterTrait
24*33c34396SGreg Roach{
25*33c34396SGreg Roach    /** @var int The default position for this footer.  It can be changed in the control panel. */
26*33c34396SGreg Roach    protected $footer_order = 0;
27*33c34396SGreg Roach
28*33c34396SGreg Roach    /**
29*33c34396SGreg Roach     * Users change change the order of footers using the control panel.
30*33c34396SGreg Roach     *
31*33c34396SGreg Roach     * @param int $footer_order
32*33c34396SGreg Roach     *
33*33c34396SGreg Roach     * @return void
34*33c34396SGreg Roach     */
35*33c34396SGreg Roach    public function setFooterOrder(int $footer_order): void
36*33c34396SGreg Roach    {
37*33c34396SGreg Roach        $this->footer_order = $footer_order;
38*33c34396SGreg Roach    }
39*33c34396SGreg Roach
40*33c34396SGreg Roach    /**
41*33c34396SGreg Roach     * Users change change the order of footers using the control panel.
42*33c34396SGreg Roach     *
43*33c34396SGreg Roach     * @return int
44*33c34396SGreg Roach     */
45*33c34396SGreg Roach    public function getFooterOrder(): int
46*33c34396SGreg Roach    {
47*33c34396SGreg Roach        return $this->footer_order ?? $this->defaultFooterOrder();
48*33c34396SGreg Roach    }
49*33c34396SGreg Roach
50*33c34396SGreg Roach    /**
51*33c34396SGreg Roach     * The default position for this footer.
52*33c34396SGreg Roach     *
53*33c34396SGreg Roach     * @return int
54*33c34396SGreg Roach     */
55*33c34396SGreg Roach    public function defaultFooterOrder(): int
56*33c34396SGreg Roach    {
57*33c34396SGreg Roach        return 9999;
58*33c34396SGreg Roach    }
59*33c34396SGreg Roach
60*33c34396SGreg Roach    /**
61*33c34396SGreg Roach     * A footer, to be added at the bottom of every page.
62*33c34396SGreg Roach     *
63*33c34396SGreg Roach     * @return string
64*33c34396SGreg Roach     */
65*33c34396SGreg Roach    public function getFooter(): string
66*33c34396SGreg Roach    {
67*33c34396SGreg Roach        return '';
68*33c34396SGreg Roach    }
69*33c34396SGreg Roach}
70