-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy paththeme-settings.php
executable file
·515 lines (481 loc) · 20 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
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
<?php
function byu_theme_form_system_theme_settings_alter(&$form, Drupal\Core\Form\FormStateInterface $form_state) {
// ----------- GENERAL -----------
$form['options']['general'] = [
'#type' => 'fieldset',
'#title' => t('General'),
];
// Loader Setting
$form['options']['general']['loader'] = [
'#type' => 'checkbox',
'#title' => 'On/Off Loader',
'#default_value' => theme_get_setting('loader'),
];
// ----------- DESIGN -----------
$form['options']['design'] = [
'#type' => 'vertical_tabs',
'#title' => 'BYU Style Options: Design Your Site',
'#open' => FALSE,
];
// component versions
$form['byu_components'] = [
'#type' => 'details',
'#title' => t('BYU Component Settings'),
'#group' => 'design',
];
$form['byu_components']['components_version'] = [
'#type' => 'select',
'#title' => t('Which version of BYU Web components do you want to load?'),
'#description' => t('1.x.x. is recommended because it will incorporate all new features and bug fixes without big changes that may require manual adjustments.'),
'#options' => [
'1.x.x' => t('1.x.x - Get new features & bug fixes'),
'1.2.x' => t('1.2.x - Stay on version 1.2 and only get bug fixes, no features'),
'1.3.x' => t('1.3.x - Stay on version 1.3 and only get bug fixes, no features'),
'latest' => t('Latest - every update, including major version changes.'),
'master' => t('Master - Latest development, Use for Development & Testing.'),
'none' => t('Don\'t load components. This is primarily for testing purposes.'),
],
'#default_value' => theme_get_setting('components_version'),
];
// Fonts
$form['fonts'] = [
'#type' => 'details',
'#title' => t('BYU Font Settings'),
'#group' => 'design',
];
$form['fonts']['google_info'] = [
'#markup' => '<p> These are the google font alternatives.</p>',
];
$form['fonts']['fontawesome_use'] = [
'#type' => 'checkbox',
'#title' => t('Load FontAwesome 4 library'),
'#default_value' => theme_get_setting('fontawesome_use'),
];
$form['fonts']['libreberville_use'] = [
'#type' => 'checkbox',
'#title' => t('Load Libre Baskerville font'),
'#default_value' => theme_get_setting('libreberville_use'),
'#description' => t('This serif font is a google font alternative, and may load faster. Click Save, and then this font will be available in the options below.'),
];
$form['fonts']['sourcesans_use'] = [
'#type' => 'checkbox',
'#title' => t('Load Source Sans font'),
'#default_value' => theme_get_setting('sourcesans_use'),
'#description' => t('This sans-serif font is a google font alternative, and may load faster. Click Save, and then this font will be available in the options below.'),
];
$form['fonts']['roboto_use'] = [
'#type' => 'checkbox',
'#title' => t('Use the google alternatives to Ringside (Roboto).'),
'#default_value' => theme_get_setting('roboto_use'),
'#description' => t('See <a href="https://byu.box.com/s/kk3iv6hzn7xwagaiv1jdiyytbj0n3i99">here</a> for example.'),
];
$libre_en = theme_get_setting('libreberville_use');
$sourcesans_en = theme_get_setting('sourcesans_use');
$roboto_use = theme_get_setting('roboto_use');
$fontOptions = [
"ringside" => "Ringside",
];
if ($libre_en == TRUE) {
$fontOptions['libreb'] = 'Libre Baskerville';
}
if ($sourcesans_en == TRUE) {
$fontOptions['sourcesans'] = 'Source Sans';
}
if ($roboto_use == TRUE) {
$fontOptions['roboto'] = 'Roboto';
}
$form['fonts']['font_one'] = [
'#type' => 'select',
'#title' => t('H1 Font'),
'#options' => $fontOptions,
'#default_value' => theme_get_setting('font_one'),
];
$form['fonts']['font_one_color'] = [
'#type' => 'select',
'#title' => t('H1 Color'),
'#options' => [
'h1-navy' => t('Navy'),
'h1-gray' => t('Gray'),
'h1-black' => t('Black'),
],
'#default_value' => theme_get_setting('font_one_color'),
];
$form['fonts']['font_two'] = [
'#type' => 'select',
'#title' => t('H2 Font'),
'#options' => $fontOptions,
'#default_value' => theme_get_setting('font_two'),
];
$form['fonts']['font_two_color'] = [
'#type' => 'select',
'#title' => t('H2 Color'),
'#options' => [
'h2-navy' => t('Navy'),
'h2-gray' => t('Gray'),
'h2-black' => t('Black'),
],
'#default_value' => theme_get_setting('font_two_color'),
];
$form['fonts']['font_three'] = [
'#type' => 'select',
'#title' => t('H3 Font'),
'#options' => $fontOptions,
'#default_value' => theme_get_setting('font_three'),
];
$form['fonts']['font_three_color'] = [
'#type' => 'select',
'#title' => t('H3 Color'),
'#options' => [
'h3-navy' => t('Navy'),
'h3-gray' => t('Gray'),
'h3-black' => t('Black'),
],
'#default_value' => theme_get_setting('font_three_color'),
];
$form['fonts']['font_four'] = [
'#type' => 'select',
'#title' => t('H4 Font'),
'#options' => $fontOptions,
'#default_value' => theme_get_setting('font_four'),
];
$form['fonts']['font_four_color'] = [
'#type' => 'select',
'#title' => t('H4 Color'),
'#options' => [
'h4-navy' => t('Navy'),
'h4-gray' => t('Gray'),
'h4-black' => t('Black'),
],
'#default_value' => theme_get_setting('font_four_color'),
];
$form['fonts']['font_five'] = [
'#type' => 'select',
'#title' => t('H5 Font'),
'#options' => $fontOptions,
'#default_value' => theme_get_setting('font_five'),
];
$form['fonts']['font_five_color'] = [
'#type' => 'select',
'#title' => t('H5 Color'),
'#options' => [
'h5-navy' => t('Navy'),
'h5-gray' => t('Gray'),
'h5-black' => t('Black'),
],
'#default_value' => theme_get_setting('font_five_color'),
];
$pFontOptions = [
'default' => t('Default'),
'ringside' => t('Ringside (sans-serif)'),
];
if ($libre_en == TRUE) {
$pFontOptions['libreb'] = 'Libre Baskerville';
}
if ($sourcesans_en == TRUE) {
$pFontOptions['sourcesans'] = 'Source Sans';
}
if ($roboto_use == TRUE) {
$pFontOptions['roboto'] = 'Roboto';
}
$form['fonts']['p_font'] = [
'#type' => 'select',
'#title' => t('Paragraph Font'),
'#options' => $pFontOptions,
'#default_value' => theme_get_setting('p_font'),
];
// Header Option
$form['header_style'] = [
'#type' => 'details',
'#title' => 'BYU Header',
'#group' => 'design',
];
$form['header_style']['subtitle'] = [
'#type' => 'fieldset',
'#title' => 'Subtitle Settings',
'#open' => FALSE,
];
$form['header_style']['subtitle']['subtitle_use'] = [
'#type' => 'checkbox',
'#title' => t('Use Subtitle'),
'#default_value' => theme_get_setting('subtitle_use'),
'#description' => t("Add Sub Title to the site header."),
];
$form['header_style']['subtitle']['subtitle_italic'] = [
'#type' => 'checkbox',
'#title' => t('Subtitle Italic'),
'#default_value' => theme_get_setting('subtitle_italic'),
'#description' => t("Italicize the subtitle."),
];
$form['header_style']['subtitle']['subtitle_text'] = [
'#type' => 'textfield',
'#title' => t('Site Subtitle'),
'#default_value' => theme_get_setting('subtitle_text'),
'#description' => t("The subtitle appears below the Main Title."),
];
$form['header_style']['user_info'] = [
'#type' => 'fieldset',
'#title' => 'User Information & SIgn In Settings',
'#open' => TRUE,
];
$form['header_style']['user_info']['login_use'] = [
'#type' => 'checkbox',
'#title' => t('Display Sign In/Out block'),
'#default_value' => theme_get_setting('login_use'),
'#description' => t("Choose to display a Sign In link."),
];
$form['header_style']['user_info']['login_url'] = [
'#type' => 'textfield',
'#title' => t('Login Url'),
'#default_value' => theme_get_setting('login_url'),
'#description' => t("The subtitle appears below (or above) the Main Title. Default value if blank is '../user'. If you are using the CAS module, use '../cas'."),
];
$form['header_style']['user_info']['logout_url'] = [
'#type' => 'textfield',
'#title' => t('Logout Url'),
'#default_value' => theme_get_setting('logout_url'),
'#description' => t("The subtitle appears below (or above) the Main Title. Default value if blank is '../user/logout'. If you are using the CAS module, use '../caslogout'."),
];
$form['header_style']['user_info']['myaccount_use'] = [
'#type' => 'checkbox',
'#title' => t('My Account'),
'#default_value' => theme_get_setting('myaccount_use'),
'#description' => t("Link the username / name display to a user account page."),
];
$form['header_style']['user_info']['myaccount_url'] = [
'#type' => 'textfield',
'#title' => t('My Account Url'),
'#default_value' => theme_get_setting('myaccount_url'),
// '#default_value' => variable_get('myaccount_url', '../user/'),
// '#default_value' => '../user',
'#description' => t("Provide the relative url for my account. Default value if blank is '../user'."),
];
/* ------ Search Settings ------ */
$form['header_style']['search'] = [
'#type' => 'fieldset',
'#title' => 'Search Settings',
'#open' => FALSE,
];
$form['header_style']['search']['search_use'] = [
'#type' => 'checkbox',
'#title' => t('Display a Search bar in the header'),
'#default_value' => theme_get_setting('search_use'),
// '#description' => t("Choose to display a Sign In link."),
];
$form['header_style']['search']['search_input'] = [
'#type' => 'textfield',
'#title' => t('Alternate Search Input'),
'#default_value' => theme_get_setting('search_input'),
'#description' => t("If you're using a different search module and the component is having difficulty finding the search input, enter the class, id, or attribute name (include the period, hashtag, or brackets) of your search input. This will tell the component exactly what content to search. For example: [data-drupal-selector=\'edit-keys\'] or #my-search-input. Please note that, in Drupal, some IDs change, so make sure you're picking a permanent one. Also note that you should use single quotes instead of double quotes, as this will be wrapped in double quotes inside the component."),
];
$form['header_style']['search']['search_submit'] = [
'#type' => 'textfield',
'#title' => t('Alternate Search Submit'),
'#default_value' => theme_get_setting('search_submit'),
'#description' => t("If you're using a different search module and the component is having difficulty finding the submit button, enter the class, id, or attribute name (include the period, hashtag, or brackets) of your submit button. This will tell the component exactly what button to trigger. For example: [data-drupal-selector=\'edit-submit\'] or #my-submit-button. Please note that, in Drupal, some IDs change, so make sure you're picking a permanent one. Also note that you should use single quotes instead of double quotes, as this will be wrapped in double quotes inside the component."),
];
$form['header_style']['search']['search_info'] = [
'#markup' => '<p>For more information on how the search component works, go to <a href="http://2017-components-demo.cdn.byu.edu/byu-search.html">http://2017-components-demo.cdn.byu.edu/byu-search.html</a>.</p>',
];
//Header Actions Settings
$form['header_style']['header_actions'] = [
'#type' => 'fieldset',
'#title' => t('Action Links'),
'#open' => FALSE,
];
$form['header_style']['header_actions']['actions_info'] = [
'#markup' => '<p>Action Links are very short links for a unique user action. For instance, this could be an "Apply" link or "Cart".
There should only ever be 2 one-word links or one 2-word link, as this space is minimal. To place these links, go to
the <a href="../admin/structure/block" target="_blank">blocks page</a> and place a block into the Header Actions region.</p><p>Action links
are placed at the bottom of the menu in mobile views. Please make sure your content fits at various breakpoints.</p>',
];
//Menu Settings
$form['header_style']['menu'] = [
'#type' => 'fieldset',
'#title' => t('Menu Settings'),
'#open' => FALSE,
];
$form['header_style']['menu']['menu_disable'] = [
'#type' => 'checkbox',
'#title' => t('Disable the menu.'),
'#default_value' => theme_get_setting('menu_disable'),
// '#description' => t("This allows part of the hero to show through behind the menu."),
];
$form['header_style']['menu']['transparent'] = [
'#type' => 'checkbox',
'#title' => t('Make menu background transparent'),
'#default_value' => theme_get_setting('transparent'),
'#description' => t("This allows part of the hero to show through behind the menu."),
];
// Hero
$form['header_style']['hero'] = [
'#type' => 'fieldset',
'#title' => t('Hero Settings'),
'#open' => FALSE,
];
$form['header_style']['hero']['hero_width'] = [
'#type' => 'select',
'#title' => t('Hero Space Width'),
'#options' => [
0 => t("Full Width (default)"),
1 => t('Custom Width'),
],
'#description' => t('The custom page width setting is under BYU General Page. See the next section of settings.'),
'#default_value' => theme_get_setting('hero_width'),
];
$form['header_style']['hero']['hero_vs_menu'] = [
'#type' => 'select',
'#title' => t('How do you want the Hero space & Menu to be?'),
'#default_value' => theme_get_setting('hero_vs_menu'),
'#description' => t('If enabled, the site name and main menu will appear in a bar along the top of the page. You will want to make sure that the menu background is set to transparent.'),
'#options' => [
0 => t("Show hero below the menu (default)"),
1 => t('Show hero behind menu'),
],
];
$form['header_style']['hero']['hero_image_width'] = [
'#type' => 'checkbox',
'#title' => t('Make images stretch full width'),
'#default_value' => theme_get_setting('hero_image_width'),
'#description' => t("Whether you are using a full width or constrained width hero, use this setting to tell images to expand to the full width of the hero space."),
];
/* ---- General Page settings -- */
$form['general_page'] = [
'#type' => 'details',
'#title' => t('BYU General Page'),
// '#collapsible' => TRUE,
'#group' => 'design',
];
$form['general_page']['full_width'] = [
'#type' => 'checkbox',
'#title' => t('Full Width instead of Constrained Width'),
'#default_value' => theme_get_setting('full_width'),
'#description' => t("Choose to have all pages extend full width. This applies to BYU Header, page content, and BYU Footer. The hero space has it's own setting for width, and this will not override that."),
];
$form['general_page']['custom_width'] = [
'#type' => 'select',
'#title' => t('Custom Page Width'),
'#default_value' => theme_get_setting('custom_width'),
'#description' => t("Enter the number of pixels you would like. i.e. '1200' fof 1200px. Defaults to 1000px."),
'#options' => [
null => 'None',
'1400' => '1400px',
'1200' => '1200px',
'1024' => '1024px',
'1000' => '1000px',
'992' => '992px',
'940' => '940px'
]
];
$form['general_page']['min_page_height'] = [
'#type' => 'select',
'#title' => 'Custom Page Height',
'#default_value' => theme_get_setting('min_page_height'),
'#options' => [
'none' => 'None',
'300' => '300px',
'500' => '500px',
],
];
$form['general_page']['byu_styles'] = [
'#type' => 'fieldset',
'#title' => t('Extra BYU Styles'),
'#open' => FALSE,
];
$form['general_page']['byu_styles']['byu_styles_info'] = [
'#markup' => '<p>Enabling these styles doesn\'t necessarily mean the styles will immediately take effect. Most of these styles make byu classes available for use as you choose to apply them.</p>',
];
$form['general_page']['byu_styles']['byu_buttons'] = [
'#type' => 'checkbox',
'#title' => t('BYU Button Styles'),
'#default_value' => theme_get_setting('byu_buttons'),
];
$form['general_page']['byu_styles']['byu_tables'] = [
'#type' => 'checkbox',
'#title' => t('BYU Table Styles'),
'#default_value' => theme_get_setting('byu_tables'),
];
$form['general_page']['byu_styles']['byu_box_shadows'] = [
'#type' => 'checkbox',
'#title' => t('BYU Box Shadow Styles'),
'#default_value' => theme_get_setting('byu_box_shadows'),
];
$form['general_page']['your_css'] = [
'#type' => 'textarea',
'#title' => 'Add Your CSS',
'#default_value' => theme_get_setting('your_css'),
];
// Footer Option
$form['footer_style'] = [
'#type' => 'details',
'#title' => 'BYU Footer',
'#group' => 'design',
];
// Footer Option
$form['footer_style']['sticky_footer'] = [
'#type' => 'fieldset',
'#title' => t('Sticky Footer Settings'),
'#open' => FALSE,
];
$form['footer_style']['sticky_footer']['footer_sticky'] = [
'#type' => 'checkbox',
'#title' => t('Make the footer sticky'),
'#default_value' => theme_get_setting('footer_sticky'),
'#description' => t("A sticky footer will automatically stick to the bottom of the page until there is enough content to force it farther down."),
];
$form['footer_style']['footer_option'] = [
'#type' => 'select',
'#title' => 'Select a footer style option:',
'#default_value' => theme_get_setting('footer_option'),
'#options' => [
'normal' => 'Normal: 4 Even Columns',
'one_two_merged' => 'Double wide, normal, normal (2:1:1 columns) - leave Footer 4 empty.',
'two_three_merged' => 'Normal, double wide, normal (1:2:1 columns) - leave Footer 4 empty.',
'three_four_merged' => 'Normal, normal, double wide (1:1:2 columns) - leave Footer 4 empty.',
],
'#description' => 'If you select any footer layout besides normal, do not place content in the Footer 4 region. It will not be used.',
];
$form['footer_style']['footer_info'] = [
'#markup' => '<p>Note: If you are selecting a double wide column layout, you are responsible for formatting your content inside that wide column. That means if you want it to contain two columns of links, you need to add a class to do that.</p><p>The class "two-columns" is available if you would like to use that.</p>',
];
$form['footer_style']['footer_regions'] = [
'#markup' => '<p>To place content in the footer:<br>1.Make sure you have the module <a
href="https://www.drupal.org/project/block_class">block class</a> downloaded and enabled. <br>2. Go to
the <a href="../admin/structure/block" target="_blank">blocks page</a>
and place blocks into one of the footer regions. Each time you place a block, add the class "byu-footer" to each block. Footer 1, Footer 2, Footer 3, and Footer 4 correspond to the 4 footer columns.</p><p>The header for the footer column will be the block title of the first block in the region.</p>',
];
// Contact
$form['contact'] = [
'#type' => 'details',
'#title' => 'Contact',
'#description' => 'Show in header : Default + Language Dropdown',
'#group' => 'design',
];
$form['contact']['contact_option'] = [
'#type' => 'textfield',
'#default_value' => theme_get_setting('contact_option'),
'#description' => 'Show in header : Default + Language Dropdown',
];
$form['contact']['contact_about_link'] = [
'#type' => 'textfield',
'#title' => 'Link',
'#default_value' => theme_get_setting('contact_about_link'),
'#description' => 'Show in header : Default + Language Dropdown',
];
$form['contact']['contact_about'] = [
'#type' => 'textfield',
'#title' => 'Title',
'#default_value' => theme_get_setting('contact_about'),
'#description' => 'Show in header : Default + Language Dropdown',
];
$form['contact']['contact_us_link'] = [
'#type' => 'textfield',
'#title' => 'Link',
'#default_value' => theme_get_setting('contact_us_link'),
'#description' => 'Show in header : Default + Language Dropdown',
];
$form['contact']['contact_us'] = [
'#type' => 'textfield',
'#title' => 'Title',
'#default_value' => theme_get_setting('contact_us'),
];
}