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