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