1<?php 2/** 3 * webtrees: online genealogy 4 * Copyright (C) 2019 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; 21use Symfony\Component\HttpFoundation\Request; 22 23/** 24 * Interface ModuleBlockInterface - Classes and libraries for module system 25 */ 26interface ModuleBlockInterface 27{ 28 /** 29 * Generate the HTML content of this block. 30 * 31 * @param Tree $tree 32 * @param int $block_id 33 * @param string $ctype 34 * @param string[] $cfg 35 * 36 * @return string 37 */ 38 public function getBlock(Tree $tree, int $block_id, string $ctype = '', array $cfg = []): string; 39 40 /** 41 * Should this block load asynchronously using AJAX? 42 * 43 * Simple blocks are faster in-line, more comples ones 44 * can be loaded later. 45 * 46 * @return bool 47 */ 48 public function loadAjax(): bool; 49 50 /** 51 * Can this block be shown on the user’s home page? 52 * 53 * @return bool 54 */ 55 public function isUserBlock(): bool; 56 57 /** 58 * Can this block be shown on the tree’s home page? 59 * 60 * @return bool 61 */ 62 public function isTreeBlock(): bool; 63 64 /** 65 * An HTML form to edit block settings 66 * 67 * @param Tree $tree 68 * @param int $block_id 69 * 70 * @return void 71 */ 72 public function editBlockConfiguration(Tree $tree, int $block_id); 73 74 /** 75 * Update the configuration for a block. 76 * 77 * @param Request $request 78 * @param int $block_id 79 * 80 * @return void 81 */ 82 public function saveBlockConfiguration(Request $request, int $block_id); 83} 84