xref: /webtrees/app/Module/ThemeSelectModule.php (revision 4cb8d1f0eb760216ff1402f3415ef3e289b4d8b3)
1<?php
2namespace Fisharebest\Webtrees;
3
4/**
5 * webtrees: online genealogy
6 * Copyright (C) 2015 webtrees development team
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/**
20 * Class ThemeSelectModule
21 */
22class ThemeSelectModule extends Module implements ModuleBlockInterface {
23	/** {@inheritdoc} */
24	public function getTitle() {
25		return /* I18N: Name of a module */ I18N::translate('Theme change');
26	}
27
28	/** {@inheritdoc} */
29	public function getDescription() {
30		return /* I18N: Description of the “Theme change” module */ I18N::translate('An alternative way to select a new theme.');
31	}
32
33	/** {@inheritdoc} */
34	public function getBlock($block_id, $template = true, $cfg = null) {
35		/** @var BaseTheme */
36		$id = $this->getName() . $block_id;
37		$class = $this->getName() . '_block';
38		$title = $this->getTitle();
39		$menu = Theme::theme()->menuThemes();
40
41		if ($menu) {
42			$content = '<div class="center theme_form">' . $menu . '</div><br>';
43
44			if ($template) {
45				return Theme::theme()->formatBlock($id, $title, $class, $content);
46			} else {
47				return $content;
48			}
49		} else {
50			return '';
51		}
52	}
53
54	/** {@inheritdoc} */
55	public function loadAjax() {
56		return false;
57	}
58
59	/** {@inheritdoc} */
60	public function isUserBlock() {
61		return true;
62	}
63
64	/** {@inheritdoc} */
65	public function isGedcomBlock() {
66		return true;
67	}
68
69	/** {@inheritdoc} */
70	public function configureBlock($block_id) {
71	}
72}
73