xref: /webtrees/app/Module/ModuleFooterTrait.php (revision 0c8c69d4fa633b3ee8e61f082e813991aabf9076)
133c34396SGreg Roach<?php
233c34396SGreg Roach/**
333c34396SGreg Roach * webtrees: online genealogy
433c34396SGreg Roach * Copyright (C) 2019 webtrees development team
533c34396SGreg Roach * This program is free software: you can redistribute it and/or modify
633c34396SGreg Roach * it under the terms of the GNU General Public License as published by
733c34396SGreg Roach * the Free Software Foundation, either version 3 of the License, or
833c34396SGreg Roach * (at your option) any later version.
933c34396SGreg Roach * This program is distributed in the hope that it will be useful,
1033c34396SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
1133c34396SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1233c34396SGreg Roach * GNU General Public License for more details.
1333c34396SGreg Roach * You should have received a copy of the GNU General Public License
1433c34396SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
1533c34396SGreg Roach */
1633c34396SGreg Roachdeclare(strict_types=1);
1733c34396SGreg Roach
1833c34396SGreg Roachnamespace Fisharebest\Webtrees\Module;
1933c34396SGreg Roach
20*0c8c69d4SGreg Roachuse Fisharebest\Webtrees\Tree;
21*0c8c69d4SGreg Roach
2233c34396SGreg Roach/**
2333c34396SGreg Roach * Trait ModuleFooterTrait - default implementation of ModuleFooterInterface
2433c34396SGreg Roach */
2533c34396SGreg Roachtrait ModuleFooterTrait
2633c34396SGreg Roach{
2733c34396SGreg Roach    /** @var int The default position for this footer.  It can be changed in the control panel. */
28fb7a0427SGreg Roach    protected $footer_order;
2933c34396SGreg Roach
3033c34396SGreg Roach    /**
3133c34396SGreg Roach     * Users change change the order of footers using the control panel.
3233c34396SGreg Roach     *
3333c34396SGreg Roach     * @param int $footer_order
3433c34396SGreg Roach     *
3533c34396SGreg Roach     * @return void
3633c34396SGreg Roach     */
3733c34396SGreg Roach    public function setFooterOrder(int $footer_order): void
3833c34396SGreg Roach    {
3933c34396SGreg Roach        $this->footer_order = $footer_order;
4033c34396SGreg Roach    }
4133c34396SGreg Roach
4233c34396SGreg Roach    /**
4333c34396SGreg Roach     * Users change change the order of footers using the control panel.
4433c34396SGreg Roach     *
4533c34396SGreg Roach     * @return int
4633c34396SGreg Roach     */
4733c34396SGreg Roach    public function getFooterOrder(): int
4833c34396SGreg Roach    {
4933c34396SGreg Roach        return $this->footer_order ?? $this->defaultFooterOrder();
5033c34396SGreg Roach    }
5133c34396SGreg Roach
5233c34396SGreg Roach    /**
5333c34396SGreg Roach     * The default position for this footer.
5433c34396SGreg Roach     *
5533c34396SGreg Roach     * @return int
5633c34396SGreg Roach     */
5733c34396SGreg Roach    public function defaultFooterOrder(): int
5833c34396SGreg Roach    {
5933c34396SGreg Roach        return 9999;
6033c34396SGreg Roach    }
6133c34396SGreg Roach
6233c34396SGreg Roach    /**
6333c34396SGreg Roach     * A footer, to be added at the bottom of every page.
6433c34396SGreg Roach     *
65*0c8c69d4SGreg Roach     * @param Tree|null $tree
66*0c8c69d4SGreg Roach     *
6733c34396SGreg Roach     * @return string
6833c34396SGreg Roach     */
69*0c8c69d4SGreg Roach    public function getFooter(?Tree $tree): string
7033c34396SGreg Roach    {
7133c34396SGreg Roach        return '';
7233c34396SGreg Roach    }
7333c34396SGreg Roach}
74