forked from ding2/ddbasic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
theme-settings.php
139 lines (125 loc) · 4.83 KB
/
theme-settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?php
/**
* @file
* Handle theme settings form for the theme.
*/
// We need functions.
require_once(drupal_get_path('theme', 'ddbasic') . '/inc/functions.inc');
/**
* Implements form_system_theme_settings_alter().
*/
function ddbasic_form_system_theme_settings_alter(&$form, $form_state) {
// CSS class and markup.
$form['ddbasic-settings']['classes'] = array(
'#type' => 'fieldset',
'#title' => t('Classes & Markup'),
'#description' => t('Modify the default classes and markup from Drupal.'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#weight' => -11,
);
$form['ddbasic-settings']['classes']['menu'] = array(
'#type' => 'fieldset',
'#title' => t('Menus'),
'#description' => t('Removes classes from the <li> tag in the menu.'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['ddbasic-settings']['classes']['menu']['ddbasic_classes_menu_leaf'] = array(
'#type' => 'checkbox',
'#title' => t('Remove .leaf from the li '),
'#default_value' => theme_get_setting('ddbasic_classes_menu_leaf'),
);
$form['ddbasic-settings']['classes']['menu']['ddbasic_classes_menu_has_children'] = array(
'#type' => 'checkbox',
'#title' => t('Remove .has-children from the li '),
'#default_value' => theme_get_setting('ddbasic_classes_menu_has_children'),
);
$form['ddbasic-settings']['classes']['menu']['ddbasic_classes_menu_items_mlid'] = array(
'#type' => 'checkbox',
'#title' => t('Remove the menu-mlid-[mid] class'),
'#default_value' => theme_get_setting('ddbasic_classes_menu_items_mlid'),
);
// Sticky menus.
$form['ddbasic-settings']['sticky_menus'] = array(
'#type' => 'fieldset',
'#title' => t('Sticky menus'),
'#description' => t('<h3>Sticky menus</h3>Here you can choose which menus you want to be sticky.'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#weight' => -10,
);
// Main menu sticky.
$form['ddbasic-settings']['sticky_menus']['main_menu_sticky'] = array(
'#type' => 'checkbox',
'#title' => t('Main menu sticky'),
'#description' => t('By checking this setting the main menu will be sticky (stick to the top of the page when scrolling).'),
'#default_value' => theme_get_setting('main_menu_sticky'),
);
/*
* Plugins
*/
$form['ddbasic-settings']['plugins'] = array(
'#type' => 'fieldset',
'#title' => t('Plugins'),
'#description' => t('<h3>Plugins</h3>Here you can enable plugins supplied with the core theme.'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#weight' => -10,
);
// Equalize.
$form['ddbasic-settings']['plugins']['load_equalize'] = array(
'#type' => 'checkbox',
'#title' => t('Equalize'),
'#description' => t('@link is a jQuery plugin for equalizing the height or width of elements.', array('@link' => l(t('Equalize'), 'https://github.com/tsvensen/equalize.js/'))),
'#default_value' => theme_get_setting('load_equalize'),
);
// Collapse annoying forms.
$form['theme_settings']['#collapsible'] = TRUE;
$form['theme_settings']['#collapsed'] = TRUE;
$form['theme_settings']['#weight'] = 50;
$form['logo']['#collapsible'] = TRUE;
$form['logo']['#collapsed'] = TRUE;
$form['logo']['#weight'] = 50;
$form['favicon']['#collapsible'] = TRUE;
$form['favicon']['#collapsed'] = TRUE;
$form['favicon']['#weight'] = 50;
// iOS icon.
$form['iosicon'] = array(
'#type' => 'fieldset',
'#title' => t('iOS icon settings'),
'#description' => t("Your iOS icon, is displayed at the homescreen."),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['iosicon']['default_iosicon'] = array(
'#type' => 'checkbox',
'#title' => t('Use the default iOS icon.'),
'#default_value' => TRUE,
'#description' => t('Check here if you want the theme to use the default iOS icon.'),
);
$form['iosicon']['settings'] = array(
'#type' => 'container',
'#states' => array(
// Hide the favicon settings when using the default favicon.
'invisible' => array(
'input[name="default_iosicon"]' => array('checked' => TRUE),
),
),
);
$form['iosicon']['settings']['iosicon_path'] = array(
'#type' => 'textfield',
'#title' => t('Path to custom iOS icon'),
'#description' => t('The path to the image file you would like to use as your custom iOS icon.'),
);
$form['iosicon']['settings']['iosicon_upload'] = array(
'#type' => 'file',
'#title' => t('Upload iOS icon image'),
'#description' => t("If you don't have direct file access to the server, use this field to upload your iOS icon."),
);
// Add css file to display:none on preview.
drupal_add_css(drupal_get_path('theme', 'ddbasic') . "/color/disable.css");
// Validate and submit logo, iOS logo and favicon.
$form['#validate'][] = 'ding2_module_selection_form_validate';
$form['#submit'][] = 'ding2_module_selection_form_submit';
}