1<?php
2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
3//
4// All Rights Reserved. See copyright.txt for details and a complete list of authors.
5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6// $Id$
7
8function prefs_theme_list($partial = false)
9{
10	global $prefs;
11	$themelib = TikiLib::lib('theme');
12
13	//get list of themes and make the first character of array values uppercase
14	$themes = array_map('ucfirst', $themelib->list_themes());
15	//get list of theme options
16	$theme_options = [
17		'' => tr('None'),
18	];
19	if (! $partial) {
20		$theme_options = $theme_options + $themelib->get_options();
21	}
22
23	//admin themes -> add empty option which means that site theme should be used. Also remove Custom URL.
24	$admin_themes = [
25		'' => tr('Site theme'),
26	];
27	$admin_themes = $admin_themes + $themes;
28	unset($admin_themes['custom_url']); //remove custom URL from the list
29
30	//get list of icon sets shipped by Tiki
31	$iconsets = $themelib->list_base_iconsets();
32	$iconsets['theme_specific_iconset'] = tr('Icons of the displayed theme'); //add a specific option to allow theme specific icon set to be used
33
34	return [
35		'theme' => [
36			'name' => tr('Site theme'),
37			'description' => tr('The default theme for the site. Themes are bootstrap.css variants, including original Tiki themes as well as implementations of themes from Bootswatch.com. For more information about Bootstrap, see getbootstrap.com.'),
38			'type' => 'list',
39			'default' => 'default',
40			'options' => $themes,
41			'help' => 'Themes',
42			'tags' => ['basic'],
43		],
44		'theme_option' => [
45			'name' => tra('Site theme option'),
46			'type' => 'list',
47			'help' => 'Themes',
48			'description' => tra('Supplemental style sheet for the selected theme'),
49			'options' => $theme_options,
50			'default' => '',
51			'tags' => ['basic'],
52			'keywords' => tra('theme option, theme-option, style option, options, css'),
53		],
54		'theme_custom_url' => [
55			'name' => tr('Custom theme URL'),
56			'description' => tr('Local or external URL of the custom Bootstrap-compatible CSS file to use.'),
57			'type' => 'text',
58			'filter' => 'url',
59			'default' => '',
60			'tags' => ['basic'],
61		],
62		'theme_admin' => [
63			'name' => tra('Admin theme'),
64			'type' => 'list',
65			'help' => 'Themes',
66			'description' => tra('Theme for the settings panels and other administration pages'),
67			'options' => $admin_themes,
68			'default' => '',
69			'tags' => ['basic'],
70		],
71		'theme_option_admin' => [
72			'name' => tra('Admin theme option'),
73			'type' => 'list',
74			'help' => 'Themes',
75			'description' => tra('Supplemental style sheet for the selected theme'),
76			'options' => $theme_options,
77			'default' => '',
78			'tags' => ['basic'],
79		],
80		'theme_option_includes_main' => [
81			'name' => tra('Option theme includes main theme CSS'),
82			'type' => 'flag',
83			'help' => 'Themes',
84			'description' => tra('Don\'t include the main theme stylesheet because its contents are included in the option stylesheet.'),
85			'default' => 'n',
86		],
87        'theme_navbar_color_variant' => [
88            'name' => tra('Navbar background color'),
89            'type' => 'radio',
90            'options' => [
91                'dark' => tra('Dark'),
92                'light' => tra('Light'),
93            ],
94            'help' => 'Themes',
95            'description' => tra('Select a dark or light navbar (containing horizontal menu, etc.), as styled by the theme.'),
96            'default' => 'light',
97        ],
98		'theme_navbar_fixed_topbar_offset' => [
99			'name' => tra('Fixed topbar offset'),
100			'type' => 'text',
101			'size' => '4',
102			'filter' => 'digits',
103			'units' => 'px',
104			'help' => 'Themes',
105			'description' => tra('The offset value of the top padding should be the same height as the navbar in the fixed top position to prevent the navbar from obscuring the page content.'),
106			'default' => '',
107			'keywords' => tra('topbar offset, top offset, fixed topbar, top padding, offset'),
108			'tags' => ['basic'],
109		],
110		'theme_iconset' => [
111			'name' => tr('Icons'),
112			'description' => tr('Icon set used by the site.'),
113			'type' => 'list',
114			'options' => $iconsets,
115			'default' => 'default',
116			'help' => 'Icons',
117			'tags' => ['basic'],
118		],
119		'theme_customizer' => [
120			'name' => tra('Theme Customizer tool'),
121			'description' => tra('Activate the theme customizer tool to enable easy theme customization.'),
122			'type' => 'flag',
123			'help' => 'Themes',
124			'default' => 'n',
125			'tags' => ['experimental'],
126			'view' => TikiLib::lib('service')->getUrl(['controller' => 'styleguide', 'action' => 'show']),
127		],
128	];
129}
130