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\I18N; 21use Fisharebest\Webtrees\Menu; 22use Fisharebest\Webtrees\Tree; 23 24/** 25 * The clouds theme. 26 */ 27class CloudsTheme extends AbstractModule implements ModuleThemeInterface 28{ 29 use ModuleThemeTrait { 30 genealogyMenu as baseGenealogyMenu; 31 } 32 33 /** 34 * How should this module be identified in the control panel, etc.? 35 * 36 * @return string 37 */ 38 public function title(): string 39 { 40 /* I18N: Name of a theme. */ 41 return I18N::translate('clouds'); 42 } 43 44 /** 45 * Misecellaneous dimensions, fonts, styles, etc. 46 * 47 * @param string $parameter_name 48 * 49 * @return string|int|float 50 */ 51 public function parameter($parameter_name) 52 { 53 $parameters = [ 54 'chart-background-f' => 'e9daf1', 55 'chart-background-m' => 'b1cff0', 56 'chart-background-u' => 'eeeeee', 57 'chart-box-x' => 260, 58 'chart-box-y' => 85, 59 'chart-font-color' => '000000', 60 'chart-spacing-x' => 4, 61 'chart-spacing-y' => 10, 62 'compact-chart-box-x' => 240, 63 'compact-chart-box-y' => 50, 64 'distribution-chart-high-values' => '95b8e0', 65 'distribution-chart-low-values' => 'c8e7ff', 66 'distribution-chart-no-values' => 'ffffff', 67 ]; 68 69 return $parameters[$parameter_name]; 70 } 71 72 /** 73 * Generate a list of items for the main menu. 74 * 75 * @param Tree|null $tree 76 * 77 * @return Menu[] 78 */ 79 public function genealogyMenu(?Tree $tree): array 80 { 81 $primary_menu = $this->baseGenealogyMenu($tree); 82 83 foreach ($primary_menu as $menu) { 84 $submenus = $menu->getSubmenus(); 85 86 if (!empty($submenus)) { 87 // Insert a dummy menu / label into the submenu 88 array_unshift($submenus, new Menu($menu->getLabel(), '#', '', ['onclick' => 'return false;'])); 89 $menu->setSubmenus($submenus); 90 } 91 } 92 93 return $primary_menu; 94 } 95 96 /** 97 * A list of CSS files to include for this page. 98 * 99 * @return string[] 100 */ 101 public function stylesheets(): array 102 { 103 return [ 104 asset('css/clouds.min.css'), 105 ]; 106 } 107} 108