-
Notifications
You must be signed in to change notification settings - Fork 0
/
theme-settings.php
381 lines (368 loc) · 13.9 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
<?php
function md_filmmaker_form_system_theme_settings_alter(&$form, &$form_state){
$path = drupal_get_path('theme', 'md_filmmaker');
//Add library
$form['#attached']['library'][] = 'md_filmmaker/theme-settings';
$form['md_filmmaker_settings'] = array(
'#type' => 'vertical_tabs',
'#title' => t('ADVANCED THEME SETTINGS'),
'#default_tab' => 'edit-publication',
);
/*$file = file_load(theme_get_setting('custom_background')[0]);
kint($file);
print file_create_url($file->getFileUri());*/
//Background settings
$form['background_settings'] = array(
'#type' => 'details',
'#title' => t('Background'),
'#group' => 'md_filmmaker_settings',
);
$form['background_settings']['background'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['background_settings']['background']['background_desc'] = array(
'#markup' => t('Set the background image and background color. If an alternate image is needed, <a href="http://www.subtlepatterns.com/" target="_blank">Subtle Patterns</a> offers
hundreds of options. Custom background images can be uploaded by selecting the "Upload Image" button. <br/><br/>'),
);
$form['background_settings']['background']['background_color'] = array(
'#type' => 'textfield',
'#title' => t('Background Color:'),
'#description' => t('Select a background color.'),
'#default_value' => theme_get_setting('background_color'),
);
$form['background_settings']['background']['background_image'] = array(
'#title' => 'Background Image:',
'#type' => 'select',
'#options' => array(
'no-bg' => 'No Background Images',
'custom-bg' => 'Custom Background Image'
),
'#default_value' => theme_get_setting('background_image'),
);
$form['background_settings']['background']['custom_background_wrap'] = array(
'#type' => 'container',
'#states' => array(
'visible' => array(
':input[name="background_image"]' => array('value' => 'custom-bg'),
),
),
);
$form['background_settings']['background']['custom_background_wrap']['custom_background'] = array(
'#title' => 'Upload Custom Background',
'#type' => 'managed_file',
'#upload_validators' => array(
'file_validate_extensions' => array(0 => 'png jpg jpeg gif'),
),
'#upload_location' => 'public://images/',
'#description' => t("Upload an image."),
'#default_value' => theme_get_setting('custom_background'),
);
$form['background_settings']['background']['custom_background_wrap']['custom_background_position'] = array(
'#title' => 'Background Position:',
'#type' => 'select',
'#options' => array(
'left top' => 'Left Top',
'left center' => 'Left Center',
'left bottom' => 'Left Bottom',
'right top' => 'Right Top',
'right center' => 'Right Center',
'right bottom' => 'Right Bottom',
'center top' => 'Center Top',
'center center' => 'Center Center',
'center bottom' => 'Center Bottom',
'initial' => 'Initial',
'inherit' => 'Inherit',
),
'#default_value' => theme_get_setting('custom_background_position'),
);
$form['background_settings']['background']['custom_background_wrap']['custom_background_mode'] = array(
'#title' => 'Background Mode:',
'#type' => 'select',
'#options' => array(
'repeat' => 'Repeat All',
'repeat-x' => 'Repeat Horizontally',
'repeat-y' => 'Repeat Vertically',
'no-repeat' => 'No Repeat',
'cover' => 'FullCover',
'fixed' => 'Fixed',
),
'#default_value' => theme_get_setting('custom_background_mode'),
);
//Typography settings
$form['typography_settings'] = array(
'#type' => 'details',
'#title' => t('Typography'),
'#group' => 'md_filmmaker_settings',
);
$form['typography_settings']['typo'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['typography_settings']['typo']['typo_desc'] = array(
'#markup' => t('Configure the typography settings. For instructions on adding Google Web Fonts, please refer to the "Theme Settings" portion of the theme documentation.'),
);
$form['typography_settings']['typo']['font'] = array(
'#type' => 'details',
'#title' => t('Custom Font'),
);
$form['typography_settings']['typo']['font']['googlewebfonts'] = array(
'#type' => 'textarea',
'#title' => t('@import:'),
'#default_value' => theme_get_setting('googlewebfonts'),
'#description' => t("For example: http://fonts.googleapis.com/css?family=Kavoon|Hanalei+Fill"),
'#prefix' => '<ul>
<li>Go to <a href="http://www.google.com/webfonts" target="_blank">www.google.com/webfonts</a>, choose your fonts and add to collection</li>
<li>Click "Use" in the bottom bar after choose fonts</li>
<li>Find "Integrate the fonts into your CSS", copy all code from that field and paste it below to activate.</li>
</ul>',
);
$form['typography_settings']['typo']['headings'] = array(
'#type' => 'details',
'#title' => t('Headings'),
);
$headings = array(1,2,3,4,5,6);
foreach($headings as $item) {
$form['typography_settings']['typo']['headings']['heading-'.$item] = array(
'#type' => 'details',
'#title' => t('Heading '.$item),
);
$form['typography_settings']['typo']['headings']['heading-'.$item]['h'.$item.'-font-type'] = array(
'#type' => 'select',
'#title' => t('Font Type:'),
'#default_value' => theme_get_setting('h'.$item.'-font-type'),
'#description' => t('Select the font type.'),
'#options' => array(
'default-font' => t('Default Font'),
'google-font' => t('Google Webfont'),
),
);
$form['typography_settings']['typo']['headings']['heading-'.$item]['h'.$item.'-webfont'] = array(
'#type' => 'textfield',
'#title' => t('Font Family:'),
'#default_value' => theme_get_setting('h'.$item.'-webfont'),
'#attributes' => array('class' => array('webfont'), 'title' => t('')),
'#states' => array(
'visible' => array( // Action to take: check the checkbox.
':input[name="h'.$item.'-font-type"]' => array('value' => 'google-font'),
),
),
);
$form['typography_settings']['typo']['headings']['heading-'.$item]['h'.$item.'-fontsize'] = array(
'#type' => 'textfield',
'#field_suffix' => 'px',
'#title' => t('Font Size:'),
'#maxlength' => 7,
'#default_value' => theme_get_setting('h'.$item.'-fontsize'),
'#states' => array(
'visible' => array( // Action to take: check the checkbox.
':input[name="h'.$item.'-font-type"]' => array('value' => 'google-font'),
),
),
);
$form['typography_settings']['typo']['headings']['heading-'.$item]['h'.$item.'-color'] = array(
'#type' => 'textfield',
'#field_suffix' => '<br/>',
'#title' => t('Color:'),
'#default_value' => theme_get_setting('h'.$item.'-color'),
'#states' => array(
'visible' => array( // Action to take: check the checkbox.
':input[name="h'.$item.'-font-type"]' => array('value' => 'google-font'),
),
),
);
$form['typography_settings']['typo']['headings']['heading-'.$item]['h'.$item.'-fontweight'] = array(
'#type' => 'textfield',
'#title' => t('Font Weight:'),
'#maxlength' => 7,
'#default_value' => theme_get_setting('h'.$item.'-fontweight'),
'#states' => array(
'visible' => array( // Action to take: check the checkbox.
':input[name="h'.$item.'-font-type"]' => array('value' => 'google-font'),
),
),
);
$form['typography_settings']['typo']['headings']['heading-'.$item]['h'.$item.'-font-style'] = array(
'#type' => 'select',
'#title' => t('Font Style:'),
'#default_value' => theme_get_setting('h'.$item.'-font-style'),
'#options' => array(
'normal' => t('Normal'),
'italic' => t('Italic'),
'oblique' => t('Oblique'),
),
'#states' => array(
'visible' => array( // Action to take: check the checkbox.
':input[name="h'.$item.'-font-type"]' => array('value' => 'google-font'),
),
),
);
}
$form['typography_settings']['typo']['hyperlinks'] = array(
'#type' => 'details',
'#title' => t('Hyperlinks'),
);
$form['typography_settings']['typo']['hyperlinks']['hyperlinks_desc'] = array(
'#markup' => t('Configure the style settings for default, hover, active, and visited hyperlink states.'),
);
$links = array('normal', 'hover', 'visited', 'active');
foreach($links as $item) {
$form['typography_settings']['typo']['hyperlinks']['link-'.$item] = array(
'#type' => 'details',
'#title' => $item,
);
$form['typography_settings']['typo']['hyperlinks']['link-'.$item]['link-'.$item.'-color'] = array(
'#type' => 'textfield',
'#title' => t('Color:'),
'#default_value' => theme_get_setting('link-'.$item.'-color'),
);
$form['typography_settings']['typo']['hyperlinks']['link-'.$item]['link-'.$item.'-decoration'] = array(
'#type' => 'select',
'#title' => t('Text Decoration:'),
'#default_value' => theme_get_setting('link-'.$item.'-decoration'),
'#options' => array(
'none' => t('None'),
'underline' => t('Underline'),
'overline' => t('Overline'),
),
);
$form['typography_settings']['typo']['hyperlinks']['link-'.$item]['link-'.$item.'-fontweight'] = array(
'#type' => 'textfield',
'#title' => t('Font Weight:'),
'#maxlength' => 7,
'#default_value' => theme_get_setting('link-'.$item.'-fontweight'),
);
$form['typography_settings']['typo']['hyperlinks']['link-'.$item]['link-'.$item.'-font-style'] = array(
'#type' => 'select',
'#title' => t('Font Style:'),
'#default_value' => theme_get_setting('link-'.$item.'-font-style'),
'#options' => array(
'normal' => t('Normal'),
'italic' => t('Italic'),
'oblique' => t('Oblique'),
),
);
}
$form['typography_settings']['typo']['base'] = array(
'#type' => 'details',
'#title' => t('Base Font'),
);
$form['typography_settings']['typo']['base']['base_desc'] = array(
'#markup' => t('<div>Configure the style settings for the body font.</div>'),
);
$form['typography_settings']['typo']['base']['base_font_type'] = array(
'#type' => 'select',
'#title' => t('Font Type:'),
'#default_value' => theme_get_setting('base_font_type'),
'#description' => t('Select the font type.'),
'#options' => array(
'default-font' => t('Default Font'),
'google-font' => t('Google Webfont'),
),
);
$form['typography_settings']['typo']['base']['base_webfont'] = array(
'#type' => 'textfield',
'#title' => t('Font Family:'),
'#default_value' => theme_get_setting('base_webfont'),
'#states' => array(
'visible' => array( // Action to take: check the checkbox.
':input[name="base_font_type"]' => array('value' => 'google-font'),
),
),
);
$form['typography_settings']['typo']['base']['base_fontsize'] = array(
'#type' => 'textfield',
'#field_suffix' => 'px',
'#title' => t('Font Size:'),
'#maxlength' => 7,
'#default_value' => theme_get_setting('base_fontsize'),
'#states' => array(
'visible' => array( // Action to take: check the checkbox.
':input[name="base_font_type"]' => array('value' => 'google-font'),
),
),
);
$form['typography_settings']['typo']['base']['base_color'] = array(
'#type' => 'textfield',
'#field_suffix' => '<br/>',
'#title' => t('Color:'),
'#default_value' => theme_get_setting('base_color'),
'#states' => array(
'visible' => array( // Action to take: check the checkbox.
':input[name="base_font_type"]' => array('value' => 'google-font'),
),
),
);
$form['typography_settings']['typo']['base']['base_fontweight'] = array(
'#type' => 'textfield',
'#title' => t('Font Weight:'),
'#maxlength' => 7,
'#default_value' => theme_get_setting('base_fontweight'),
'#states' => array(
'visible' => array( // Action to take: check the checkbox.
':input[name="base_font_type"]' => array('value' => 'google-font'),
),
),
);
$form['typography_settings']['typo']['base']['base_font_style'] = array(
'#type' => 'select',
'#title' => t('Font Style:'),
'#default_value' => theme_get_setting('base_font_style'),
'#options' => array(
'normal' => t('Normal'),
'italic' => t('Italic'),
'oblique' => t('Oblique'),
),
'#states' => array(
'visible' => array( // Action to take: check the checkbox.
':input[name="base_font_type"]' => array('value' => 'google-font'),
),
),
);
//Custom code settings
$form['code_settings'] = array(
'#type' => 'details',
'#title' => t('Custom Code'),
'#group' => 'md_filmmaker_settings',
);
$form['code_settings']['code'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['code_settings']['code']['code_header_wrap'] = array(
'#type' => 'details',
'#title' => t('Header'),
);
$form['code_settings']['code']['code_header_wrap']['code_header'] = array(
'#type' => 'textarea',
'#resizable' => FALSE,
'#rows' => 15,
'#default_value' => theme_get_setting('code_header'),
'#description' => t('The following code will be added in the <head> tag. Useful if you want to add additional script such as CSS or JS'),
);
$form['code_settings']['code']['code_footer_wrap'] = array(
'#type' => 'details',
'#title' => t('Footer'),
);
$form['code_settings']['code']['code_footer_wrap']['code_footer'] = array(
'#type' => 'textarea',
'#resizable' => FALSE,
'#rows' => 15,
'#default_value' => theme_get_setting('code_footer'),
'#description' => t('The following code will be added before the </body> tag.'),
);
$form['code_settings']['code']['code_css_wrap'] = array(
'#type' => 'details',
'#title' => t('Custom CSS'),
);
$form['code_settings']['code']['code_css_wrap']['code_css'] = array(
'#type' => 'textarea',
'#resizable' => FALSE,
'#rows' => 15,
'#default_value' => theme_get_setting('code_css'),
'#description' => t('Insert custom CSS code in here (without </style> tag). This overrides any other stylesheets. eg: a.button{color:green}'),
);
}