xref: /webtrees/app/Module/ModuleBlockInterface.php (revision 147e99aae08229316226c46b32d24d4f8bce04e0)
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	 * Generate the HTML content of this block.
28	 *
29	 * @param Tree     $tree
30	 * @param int      $block_id
31	 * @param bool     $template
32	 * @param string[] $cfg
33	 *
34	 * @return string
35	 */
36	public function getBlock(Tree $tree, int $block_id, bool $template = true, array $cfg = []): string;
37
38	/**
39	 * Should this block load asynchronously using AJAX?
40	 *
41	 * Simple blocks are faster in-line, more comples ones
42	 * can be loaded later.
43	 *
44	 * @return bool
45	 */
46	public function loadAjax(): bool;
47
48	/**
49	 * Can this block be shown on the user’s home page?
50	 *
51	 * @return bool
52	 */
53	public function isUserBlock(): bool;
54
55	/**
56	 * Can this block be shown on the tree’s home page?
57	 *
58	 * @return bool
59	 */
60	public function isGedcomBlock(): bool;
61
62	/**
63	 * An HTML form to edit block settings
64	 *
65	 * @param Tree $tree
66	 * @param int  $block_id
67	 *
68	 * @return void
69	 */
70	public function configureBlock(Tree $tree, int $block_id);
71}
72