xref: /webtrees/app/Module/ModuleBlockInterface.php (revision c1010eda29c0909ed4d5d463f32d32bfefdd4dfe)
1a25f0a04SGreg Roach<?php
2a25f0a04SGreg Roach/**
3a25f0a04SGreg Roach * webtrees: online genealogy
41062a142SGreg Roach * Copyright (C) 2018 webtrees development team
5a25f0a04SGreg Roach * This program is free software: you can redistribute it and/or modify
6a25f0a04SGreg Roach * it under the terms of the GNU General Public License as published by
7a25f0a04SGreg Roach * the Free Software Foundation, either version 3 of the License, or
8a25f0a04SGreg Roach * (at your option) any later version.
9a25f0a04SGreg Roach * This program is distributed in the hope that it will be useful,
10a25f0a04SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
11a25f0a04SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12a25f0a04SGreg Roach * GNU General Public License for more details.
13a25f0a04SGreg Roach * You should have received a copy of the GNU General Public License
14a25f0a04SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
15a25f0a04SGreg Roach */
16a9430be8SGreg Roachdeclare(strict_types=1);
17a9430be8SGreg Roach
1876692c8bSGreg Roachnamespace Fisharebest\Webtrees\Module;
19a25f0a04SGreg Roach
20e490cd80SGreg Roachuse Fisharebest\Webtrees\Tree;
21e490cd80SGreg Roach
22a25f0a04SGreg Roach/**
23a25f0a04SGreg Roach * Interface ModuleBlockInterface - Classes and libraries for module system
24a25f0a04SGreg Roach */
25*c1010edaSGreg Roachinterface ModuleBlockInterface
26*c1010edaSGreg Roach{
27a25f0a04SGreg Roach    /**
28a25f0a04SGreg Roach     * Generate the HTML content of this block.
29a25f0a04SGreg Roach     *
30e490cd80SGreg Roach     * @param Tree     $tree
31cbc1590aSGreg Roach     * @param int      $block_id
3276692c8bSGreg Roach     * @param bool     $template
33727f238cSGreg Roach     * @param string[] $cfg
34a25f0a04SGreg Roach     *
35a25f0a04SGreg Roach     * @return string
36a25f0a04SGreg Roach     */
37e490cd80SGreg Roach    public function getBlock(Tree $tree, int $block_id, bool $template = true, array $cfg = []): string;
38a25f0a04SGreg Roach
39a25f0a04SGreg Roach    /**
40a25f0a04SGreg Roach     * Should this block load asynchronously using AJAX?
4176692c8bSGreg Roach     *
42a25f0a04SGreg Roach     * Simple blocks are faster in-line, more comples ones
43a25f0a04SGreg Roach     * can be loaded later.
44a25f0a04SGreg Roach     *
45cbc1590aSGreg Roach     * @return bool
46a25f0a04SGreg Roach     */
47a9430be8SGreg Roach    public function loadAjax(): bool;
48a25f0a04SGreg Roach
49a25f0a04SGreg Roach    /**
50a25f0a04SGreg Roach     * Can this block be shown on the user’s home page?
51a25f0a04SGreg Roach     *
52cbc1590aSGreg Roach     * @return bool
53a25f0a04SGreg Roach     */
54a9430be8SGreg Roach    public function isUserBlock(): bool;
55a25f0a04SGreg Roach
56a25f0a04SGreg Roach    /**
57a25f0a04SGreg Roach     * Can this block be shown on the tree’s home page?
58a25f0a04SGreg Roach     *
59cbc1590aSGreg Roach     * @return bool
60a25f0a04SGreg Roach     */
61a9430be8SGreg Roach    public function isGedcomBlock(): bool;
62a25f0a04SGreg Roach
63a25f0a04SGreg Roach    /**
64a25f0a04SGreg Roach     * An HTML form to edit block settings
65a25f0a04SGreg Roach     *
66e490cd80SGreg Roach     * @param Tree $tree
67cbc1590aSGreg Roach     * @param int  $block_id
68a9430be8SGreg Roach     *
69a9430be8SGreg Roach     * @return void
70a25f0a04SGreg Roach     */
71e490cd80SGreg Roach    public function configureBlock(Tree $tree, int $block_id);
72a25f0a04SGreg Roach}
73