forked from moodle-an-hochschulen/moodle-theme_boost_union
-
Notifications
You must be signed in to change notification settings - Fork 1
/
settings.php
1531 lines (1305 loc) · 87.2 KB
/
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
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Theme Boost Union - Settings file
*
* @package theme_boost_union
* @copyright 2022 Alexander Bias, lern.link GmbH <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
use \theme_boost_union\admin_setting_configdatetime;
use \theme_boost_union\admin_setting_configstoredfilealwayscallback;
defined('MOODLE_INTERNAL') || die();
if ($hassiteconfig || has_capability('theme/boost_union:configure', context_system::instance())) {
// How this file works:
// This theme's settings are divided into multiple settings pages.
// This is quite unusual as Boost themes would have a nice tabbed settings interface.
// However, as we are using many hide_if constraints for our settings, we would run into the
// stupid "Too much data passed as arguments to js_call_amd..." debugging message if we would
// pack all settings onto just one settings page.
// To achieve this goal, we create a custom admin settings category and fill it with several settings pages.
// However, there is still the $settings variable which is expected by Moodle coreto be filled with the theme
// settings and which is automatically added to the admin settings tree in one settings page.
// To avoid that there appears an empty "Boost Union" settings page near our own custom settings category,
// we set $settings to null.
// Avoid that the theme settings page is auto-created.
$settings = null;
// Create custom admin settings category.
$ADMIN->add('themes', new admin_category('theme_boost_union',
get_string('pluginname', 'theme_boost_union', null, true)));
// Create empty settings page structure to make the site administration work on non-admin pages.
if (!$ADMIN->fulltree) {
// Create Look settings page
// (and allow users with the theme/boost_union:configure capability to access it).
$tab = new admin_settingpage('theme_boost_union_look',
get_string('configtitlelook', 'theme_boost_union', null, true),
'theme/boost_union:configure');
$ADMIN->add('theme_boost_union', $tab);
// Create Feel settings page
// (and allow users with the theme/boost_union:configure capability to access it).
$tab = new admin_settingpage('theme_boost_union_feel',
get_string('configtitlefeel', 'theme_boost_union', null, true),
'theme/boost_union:configure');
$ADMIN->add('theme_boost_union', $tab);
// Create Content settings page
// (and allow users with the theme/boost_union:configure capability to access it).
$tab = new admin_settingpage('theme_boost_union_content',
get_string('configtitlecontent', 'theme_boost_union', null, true),
'theme/boost_union:configure');
$ADMIN->add('theme_boost_union', $tab);
// Create Functionality settings page
// (and allow users with the theme/boost_union:configure capability to access it).
$tab = new admin_settingpage('theme_boost_union_functionality',
get_string('configtitlefunctionality', 'theme_boost_union', null, true),
'theme/boost_union:configure');
$ADMIN->add('theme_boost_union', $tab);
// Create Flavours settings page as external page
// (and allow users with the theme/boost_union:configure capability to access it).
$flavourspage = new admin_externalpage('theme_boost_union_flavours',
get_string('configtitleflavours', 'theme_boost_union', null, true),
new moodle_url('/theme/boost_union/flavours/overview.php'),
'theme/boost_union:configure');
$ADMIN->add('theme_boost_union', $flavourspage);
}
// Create full settings page structure.
// @codingStandardsIgnoreLine
else if ($ADMIN->fulltree) {
// Require the necessary libraries.
require_once($CFG->dirroot . '/theme/boost_union/lib.php');
require_once($CFG->dirroot . '/theme/boost_union/locallib.php');
// Prepare options array for select settings.
// Due to MDL-58376, we will use binary select settings instead of checkbox settings throughout this theme.
$yesnooption = array(THEME_BOOST_UNION_SETTING_SELECT_YES => get_string('yes'),
THEME_BOOST_UNION_SETTING_SELECT_NO => get_string('no'));
// Prepare regular expression for checking if the value is a percent number (from 0% to 100%) or a pixel number
// (with 3 or 4 digits) or a viewport width number (from 0 to 100).
$widthregex = '/^((\d{1,2}|100)%)|((\d{1,2}|100)vw)|(\d{3,4}px)$/';
// Create Look settings page with tabs
// (and allow users with the theme/boost_union:configure capability to access it).
$page = new theme_boost_admin_settingspage_tabs('theme_boost_union_look',
get_string('configtitlelook', 'theme_boost_union', null, true),
'theme/boost_union:configure');
// Create general settings tab.
$tab = new admin_settingpage('theme_boost_union_look_general', get_string('generalsettings', 'theme_boost', null, true));
// Create theme presets heading.
$name = 'theme_boost_union/presetheading';
$title = get_string('presetheading', 'theme_boost_union', null, true);
$setting = new admin_setting_heading($name, $title, null);
$tab->add($setting);
// Replicate the preset setting from theme_boost, but use our own file area.
$name = 'theme_boost_union/preset';
$title = get_string('preset', 'theme_boost', null, true);
$description = get_string('preset_desc', 'theme_boost', null, true);
$default = 'default.scss';
$context = context_system::instance();
$fs = get_file_storage();
$files = $fs->get_area_files($context->id, 'theme_boost_union', 'preset', 0, 'itemid, filepath, filename', false);
$choices = [];
foreach ($files as $file) {
$choices[$file->get_filename()] = $file->get_filename();
}
$choices['default.scss'] = 'default.scss';
$choices['plain.scss'] = 'plain.scss';
$setting = new admin_setting_configthemepreset($name, $title, $description, $default, $choices, 'boost_union');
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Replicate the preset files setting from theme_boost.
$name = 'theme_boost_union/presetfiles';
$title = get_string('presetfiles', 'theme_boost', null, true);
$description = get_string('presetfiles_desc', 'theme_boost', null, true);
$setting = new admin_setting_configstoredfile($name, $title, $description, 'preset', 0,
array('maxfiles' => 20, 'accepted_types' => array('.scss')));
$tab->add($setting);
// Add tab to settings page.
$page->add($tab);
// Create SCSS tab.
$tab = new admin_settingpage('theme_boost_union_look_scss', get_string('scsstab', 'theme_boost_union', null, true));
// Create Raw SCSS heading.
$name = 'theme_boost_union/scssheading';
$title = get_string('scssheading', 'theme_boost_union', null, true);
$setting = new admin_setting_heading($name, $title, null);
$tab->add($setting);
// Replicate the Raw initial SCSS setting from theme_boost.
$name = 'theme_boost_union/scsspre';
$title = get_string('rawscsspre', 'theme_boost', null, true);
$description = get_string('rawscsspre_desc', 'theme_boost', null, true);
$default = '';
$setting = new admin_setting_scsscode($name, $title, $description, $default, PARAM_RAW);
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Replicate the Raw SCSS setting from theme_boost.
$name = 'theme_boost_union/scss';
$title = get_string('rawscss', 'theme_boost', null, true);
$description = get_string('rawscss_desc', 'theme_boost', null, true);
$default = '';
$setting = new admin_setting_scsscode($name, $title, $description, $default, PARAM_RAW);
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Add tab to settings page.
$page->add($tab);
// Create page tab.
$tab = new admin_settingpage('theme_boost_union_look_page', get_string('pagetab', 'theme_boost_union', null, true));
// Create page width heading.
$name = 'theme_boost_union/pagewidthheading';
$title = get_string('pagewidthheading', 'theme_boost_union', null, true);
$setting = new admin_setting_heading($name, $title, null);
$tab->add($setting);
// Setting: Course content max width.
$name = 'theme_boost_union/coursecontentmaxwidth';
$title = get_string('coursecontentmaxwidthsetting', 'theme_boost_union', null, true);
$description = get_string('coursecontentmaxwidthsetting_desc', 'theme_boost_union', null, true);
$default = '830px';
$setting = new admin_setting_configtext($name, $title, $description, $default, $widthregex, 6);
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Setting: Medium content max width.
$name = 'theme_boost_union/mediumcontentmaxwidth';
$title = get_string('mediumcontentmaxwidthsetting', 'theme_boost_union', null, true);
$description = get_string('mediumcontentmaxwidthsetting_desc', 'theme_boost_union', null, true);
$default = '1120px';
$setting = new admin_setting_configtext($name, $title, $description, $default, $widthregex, 6);
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Add tab to settings page.
$page->add($tab);
// Create branding tab.
$tab = new admin_settingpage('theme_boost_union_look_branding', get_string('brandingtab', 'theme_boost_union', null, true));
// Create logos heading.
$name = 'theme_boost_union/logosheading';
$title = get_string('logosheading', 'theme_boost_union', null, true);
$notificationurl = new moodle_url('/admin/settings.php', array('section' => 'logos'));
$notification = new \core\output\notification(get_string('logosheading_desc', 'theme_boost_union', $notificationurl->out()),
\core\output\notification::NOTIFY_INFO);
$notification->set_show_closebutton(false);
$description = $OUTPUT->render($notification);
$setting = new admin_setting_heading($name, $title, $description);
$tab->add($setting);
// Replicate the logo setting from core_admin.
$name = 'theme_boost_union/logo';
$title = get_string('logosetting', 'theme_boost_union', null, true);
$description = get_string('logosetting_desc', 'theme_boost_union', null, true);
$setting = new admin_setting_configstoredfile($name, $title, $description, 'logo', 0,
array('maxfiles' => 1, 'accepted_types' => 'web_image'));
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Replicate the compact logo setting from core_admin.
$name = 'theme_boost_union/logocompact';
$title = get_string('logocompactsetting', 'theme_boost_union', null, true);
$description = get_string('logocompactsetting_desc', 'theme_boost_union', null, true);
$setting = new admin_setting_configstoredfile($name, $title, $description, 'logocompact', 0,
array('maxfiles' => 1, 'accepted_types' => 'web_image'));
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Create favicon heading.
$name = 'theme_boost_union/faviconheading';
$title = get_string('faviconheading', 'theme_boost_union', null, true);
$notificationurl = new moodle_url('/admin/settings.php', array('section' => 'logos'));
$notification = new \core\output\notification(get_string('faviconheading_desc', 'theme_boost_union',
$notificationurl->out()), \core\output\notification::NOTIFY_INFO);
$notification->set_show_closebutton(false);
$description = $OUTPUT->render($notification);
$setting = new admin_setting_heading($name, $title, $description);
$tab->add($setting);
// Replicate the favicon setting from core_admin.
$name = 'theme_boost_union/favicon';
$title = get_string('faviconsetting', 'theme_boost_union', null, true);
$description = get_string('faviconsetting_desc', 'theme_boost_union', null, true);
$setting = new admin_setting_configstoredfile($name, $title, $description, 'favicon', 0,
array('maxfiles' => 1, 'accepted_types' => 'image'));
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Create background images heading.
$name = 'theme_boost_union/backgroundimagesheading';
$title = get_string('backgroundimagesheading', 'theme_boost_union', null, true);
$setting = new admin_setting_heading($name, $title, null);
$tab->add($setting);
// Replicate the Background image setting from theme_boost.
$name = 'theme_boost_union/backgroundimage';
$title = get_string('backgroundimagesetting', 'theme_boost_union', null, true);
$description = get_string('backgroundimagesetting_desc', 'theme_boost_union', null, true);
$setting = new admin_setting_configstoredfile($name, $title, $description, 'backgroundimage', 0,
array('maxfiles' => 1, 'accepted_types' => 'web_image'));
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Create brand colors heading.
$name = 'theme_boost_union/brandcolorsheading';
$title = get_string('brandcolorsheading', 'theme_boost_union', null, true);
$setting = new admin_setting_heading($name, $title, null);
$tab->add($setting);
// Replicate the Variable $body-color setting from theme_boost.
$name = 'theme_boost_union/brandcolor';
$title = get_string('brandcolor', 'theme_boost', null, true);
$description = get_string('brandcolor_desc', 'theme_boost', null, true);
$setting = new admin_setting_configcolourpicker($name, $title, $description, '');
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Create Bootstrap colors heading.
$name = 'theme_boost_union/bootstrapcolorsheading';
$title = get_string('bootstrapcolorsheading', 'theme_boost_union', null, true);
$setting = new admin_setting_heading($name, $title, null);
$tab->add($setting);
// Setting: Bootstrap color for 'success'.
$name = 'theme_boost_union/bootstrapcolorsuccess';
$title = get_string('bootstrapcolorsuccesssetting', 'theme_boost_union', null, true);
$description = get_string('bootstrapcolorsuccesssetting_desc', 'theme_boost_union', null, true);
$setting = new admin_setting_configcolourpicker($name, $title, $description, '');
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Setting: Bootstrap color for 'info'.
$name = 'theme_boost_union/bootstrapcolorinfo';
$title = get_string('bootstrapcolorinfosetting', 'theme_boost_union', null, true);
$description = get_string('bootstrapcolorinfosetting_desc', 'theme_boost_union', null, true);
$setting = new admin_setting_configcolourpicker($name, $title, $description, '');
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Setting: Bootstrap color for 'warning'.
$name = 'theme_boost_union/bootstrapcolorwarning';
$title = get_string('bootstrapcolorwarningsetting', 'theme_boost_union', null, true);
$description = get_string('bootstrapcolorwarningsetting_desc', 'theme_boost_union', null, true);
$setting = new admin_setting_configcolourpicker($name, $title, $description, '');
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Setting: Bootstrap color for 'danger'.
$name = 'theme_boost_union/bootstrapcolordanger';
$title = get_string('bootstrapcolordangersetting', 'theme_boost_union', null, true);
$description = get_string('bootstrapcolordangersetting_desc', 'theme_boost_union', null, true);
$setting = new admin_setting_configcolourpicker($name, $title, $description, '');
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Create activity icon colors heading.
$name = 'theme_boost_union/activityiconcolorsheading';
$title = get_string('activityiconcolorsheading', 'theme_boost_union', null, true);
$setting = new admin_setting_heading($name, $title, null);
$tab->add($setting);
// Setting: Activity icon color for 'administration'.
$name = 'theme_boost_union/activityiconcoloradministration';
$title = get_string('activityiconcoloradministrationsetting', 'theme_boost_union', null, true);
$description = get_string('activityiconcoloradministrationsetting_desc', 'theme_boost_union', null, true);
$setting = new admin_setting_configcolourpicker($name, $title, $description, '');
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Setting: Activity icon color for 'assessment'.
$name = 'theme_boost_union/activityiconcolorassessment';
$title = get_string('activityiconcolorassessmentsetting', 'theme_boost_union', null, true);
$description = get_string('activityiconcolorassessmentsetting_desc', 'theme_boost_union', null, true);
$setting = new admin_setting_configcolourpicker($name, $title, $description, '');
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Setting: Activity icon color for 'collaboration'.
$name = 'theme_boost_union/activityiconcolorcollaboration';
$title = get_string('activityiconcolorcollaborationsetting', 'theme_boost_union', null, true);
$description = get_string('activityiconcolorcollaborationsetting_desc', 'theme_boost_union', null, true);
$setting = new admin_setting_configcolourpicker($name, $title, $description, '');
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Setting: Activity icon color for 'communication'.
$name = 'theme_boost_union/activityiconcolorcommunication';
$title = get_string('activityiconcolorcommunicationsetting', 'theme_boost_union', null, true);
$description = get_string('activityiconcolorcommunicationsetting_desc', 'theme_boost_union', null, true);
$setting = new admin_setting_configcolourpicker($name, $title, $description, '');
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Setting: Activity icon color for 'content'.
$name = 'theme_boost_union/activityiconcolorcontent';
$title = get_string('activityiconcolorcontentsetting', 'theme_boost_union', null, true);
$description = get_string('activityiconcolorcontentsetting_desc', 'theme_boost_union', null, true);
$setting = new admin_setting_configcolourpicker($name, $title, $description, '');
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Setting: Activity icon color for 'interface'.
$name = 'theme_boost_union/activityiconcolorinterface';
$title = get_string('activityiconcolorinterfacesetting', 'theme_boost_union', null, true);
$description = get_string('activityiconcolorinterfacesetting_desc', 'theme_boost_union', null, true);
$setting = new admin_setting_configcolourpicker($name, $title, $description, '');
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Add tab to settings page.
$page->add($tab);
// Create login page tab.
$tab = new admin_settingpage('theme_boost_union_look_loginpage',
get_string('loginpagetab', 'theme_boost_union', null, true));
// Create login page background images heading.
$name = 'theme_boost_union/loginbackgroundimagesheading';
$title = get_string('loginbackgroundimagesheading', 'theme_boost_union', null, true);
$setting = new admin_setting_heading($name, $title, null);
$tab->add($setting);
// Create login page background image setting.
$name = 'theme_boost_union/loginbackgroundimage';
$title = get_string('loginbackgroundimage', 'theme_boost_union', null, true);
$description = get_string('loginbackgroundimage_desc', 'theme_boost_union', null, true);
$setting = new admin_setting_configstoredfile($name, $title, $description, 'loginbackgroundimage', 0,
array('maxfiles' => 25, 'accepted_types' => 'web_image'));
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Create login page background image text setting.
$name = 'theme_boost_union/loginbackgroundimagetext';
$title = get_string('loginbackgroundimagetextsetting', 'theme_boost_union', null, true);
$description = get_string('loginbackgroundimagetextsetting_desc', 'theme_boost_union', null, true);
$setting = new admin_setting_configtextarea($name, $title, $description, null, PARAM_TEXT);
$tab->add($setting);
// Create login form heading.
$name = 'theme_boost_union/loginformheading';
$title = get_string('loginformheading', 'theme_boost_union', null, true);
$setting = new admin_setting_heading($name, $title, null);
$tab->add($setting);
// Create login form position setting.
$name = 'theme_boost_union/loginformposition';
$title = get_string('loginformpositionsetting', 'theme_boost_union', null, true);
$description = get_string('loginformpositionsetting_desc', 'theme_boost_union', null, true);
$loginformoptions = array(
THEME_BOOST_UNION_SETTING_LOGINFORMPOS_CENTER => get_string('loginformpositionsetting_center', 'theme_boost_union'),
THEME_BOOST_UNION_SETTING_LOGINFORMPOS_LEFT => get_string('loginformpositionsetting_left', 'theme_boost_union'),
THEME_BOOST_UNION_SETTING_LOGINFORMPOS_RIGHT => get_string('loginformpositionsetting_right', 'theme_boost_union'));
$setting = new admin_setting_configselect($name, $title, $description, THEME_BOOST_UNION_SETTING_LOGINFORMPOS_CENTER,
$loginformoptions);
$tab->add($setting);
// Create login form transparency setting.
$name = 'theme_boost_union/loginformtransparency';
$title = get_string('loginformtransparencysetting', 'theme_boost_union', null, true);
$description = get_string('loginformtransparencysetting_desc', 'theme_boost_union', null, true);
$setting = new admin_setting_configselect($name, $title, $description, THEME_BOOST_UNION_SETTING_SELECT_NO, $yesnooption);
$tab->add($setting);
// Add tab to settings page.
$page->add($tab);
// Create course tab.
$tab = new admin_settingpage('theme_boost_union_look_course',
get_string('coursetab', 'theme_boost_union', null, true));
// Create course header heading.
$name = 'theme_boost_union/courseheaderheading';
$title = get_string('courseheaderheading', 'theme_boost_union', null, true);
$setting = new admin_setting_heading($name, $title, null);
$tab->add($setting);
// Setting: Display the course image in the course header.
$name = 'theme_boost_union/courseheaderimageenabled';
$title = get_string('courseheaderimageenabled', 'theme_boost_union', null, true);
$description = get_string('courseheaderimageenabled_desc', 'theme_boost_union', null, true);
$setting = new admin_setting_configselect($name, $title, $description, THEME_BOOST_UNION_SETTING_SELECT_NO, $yesnooption);
$tab->add($setting);
// Setting: Fallback course header image.
$name = 'theme_boost_union/courseheaderimagefallback';
$title = get_string('courseheaderimagefallback', 'theme_boost_union', null, true);
$description = get_string('courseheaderimagefallback_desc', 'theme_boost_union', null, true);
$setting = new admin_setting_configstoredfile($name, $title, $description, 'courseheaderimagefallback', 0,
array('maxfiles' => 1, 'accepted_types' => 'web_image'));
$tab->add($setting);
$page->hide_if('theme_boost_union/courseheaderimagefallback', 'theme_boost_union/courseheaderimageenabled', 'neq',
THEME_BOOST_UNION_SETTING_SELECT_YES);
// Setting: Course header image layout.
$name = 'theme_boost_union/courseheaderimagelayout';
$title = get_string('courseheaderimagelayout', 'theme_boost_union', null, true);
$description = get_string('courseheaderimagelayout_desc', 'theme_boost_union', null, true);
$courseheaderimagelayoutoptions = array(
THEME_BOOST_UNION_SETTING_COURSEIMAGELAYOUT_STACKEDDARK =>
get_string('courseheaderimagelayoutstackeddark', 'theme_boost_union'),
THEME_BOOST_UNION_SETTING_COURSEIMAGELAYOUT_STACKEDLIGHT =>
get_string('courseheaderimagelayoutstackedlight', 'theme_boost_union'),
THEME_BOOST_UNION_SETTING_COURSEIMAGELAYOUT_HEADINGABOVE =>
get_string('courseheaderimagelayoutheadingabove', 'theme_boost_union'));
$setting = new admin_setting_configselect($name, $title, $description,
THEME_BOOST_UNION_SETTING_COURSEIMAGELAYOUT_HEADINGABOVE, $courseheaderimagelayoutoptions);
$tab->add($setting);
$page->hide_if('theme_boost_union/courseheaderimagelayout', 'theme_boost_union/courseheaderimageenabled', 'neq',
THEME_BOOST_UNION_SETTING_SELECT_YES);
// Setting: Course header image height.
$name = 'theme_boost_union/courseheaderimageheight';
$title = get_string('courseheaderimageheight', 'theme_boost_union', null, true);
$description = get_string('courseheaderimageheight_desc', 'theme_boost_union', null, true);
$courseheaderimageheightoptions = array(
THEME_BOOST_UNION_SETTING_HEIGHT_100PX => THEME_BOOST_UNION_SETTING_HEIGHT_100PX,
THEME_BOOST_UNION_SETTING_HEIGHT_150PX => THEME_BOOST_UNION_SETTING_HEIGHT_150PX,
THEME_BOOST_UNION_SETTING_HEIGHT_200PX => THEME_BOOST_UNION_SETTING_HEIGHT_200PX,
THEME_BOOST_UNION_SETTING_HEIGHT_250PX => THEME_BOOST_UNION_SETTING_HEIGHT_250PX);
$setting = new admin_setting_configselect($name, $title, $description, THEME_BOOST_UNION_SETTING_HEIGHT_150PX,
$courseheaderimageheightoptions);
$tab->add($setting);
$page->hide_if('theme_boost_union/courseheaderimageheight', 'theme_boost_union/courseheaderimageenabled', 'neq',
THEME_BOOST_UNION_SETTING_SELECT_YES);
// Setting: Course header image position.
$name = 'theme_boost_union/courseheaderimageposition';
$title = get_string('courseheaderimageposition', 'theme_boost_union', null, true);
$description = get_string('courseheaderimageposition_desc', 'theme_boost_union', null, true);
$courseheaderimagepositionoptions = array(
THEME_BOOST_UNION_SETTING_IMAGEPOSITION_CENTER_CENTER =>
THEME_BOOST_UNION_SETTING_IMAGEPOSITION_CENTER_CENTER,
THEME_BOOST_UNION_SETTING_IMAGEPOSITION_CENTER_TOP =>
THEME_BOOST_UNION_SETTING_IMAGEPOSITION_CENTER_TOP,
THEME_BOOST_UNION_SETTING_IMAGEPOSITION_CENTER_BOTTOM =>
THEME_BOOST_UNION_SETTING_IMAGEPOSITION_CENTER_BOTTOM,
THEME_BOOST_UNION_SETTING_IMAGEPOSITION_LEFT_TOP =>
THEME_BOOST_UNION_SETTING_IMAGEPOSITION_LEFT_TOP,
THEME_BOOST_UNION_SETTING_IMAGEPOSITION_LEFT_CENTER =>
THEME_BOOST_UNION_SETTING_IMAGEPOSITION_LEFT_CENTER,
THEME_BOOST_UNION_SETTING_IMAGEPOSITION_LEFT_BOTTOM =>
THEME_BOOST_UNION_SETTING_IMAGEPOSITION_LEFT_BOTTOM,
THEME_BOOST_UNION_SETTING_IMAGEPOSITION_RIGHT_TOP =>
THEME_BOOST_UNION_SETTING_IMAGEPOSITION_RIGHT_TOP,
THEME_BOOST_UNION_SETTING_IMAGEPOSITION_RIGHT_CENTER =>
THEME_BOOST_UNION_SETTING_IMAGEPOSITION_RIGHT_CENTER,
THEME_BOOST_UNION_SETTING_IMAGEPOSITION_RIGHT_BOTTOM =>
THEME_BOOST_UNION_SETTING_IMAGEPOSITION_RIGHT_BOTTOM);
$setting = new admin_setting_configselect($name, $title, $description,
THEME_BOOST_UNION_SETTING_IMAGEPOSITION_CENTER_CENTER, $courseheaderimagepositionoptions);
$tab->add($setting);
$page->hide_if('theme_boost_union/courseheaderimageposition', 'theme_boost_union/courseheaderimageenabled', 'neq',
THEME_BOOST_UNION_SETTING_SELECT_YES);
// Add tab to settings page.
$page->add($tab);
// Create E_Mail branding tab.
$tab = new admin_settingpage('theme_boost_union_look_emailbranding',
get_string('emailbrandingtab', 'theme_boost_union', null, true));
// Create E_Mail branding introduction heading.
$name = 'theme_boost_union/emailbrandingintroheading';
$title = get_string('emailbrandingintroheading', 'theme_boost_union', null, true);
$setting = new admin_setting_heading($name, $title, null);
$tab->add($setting);
// Create E-Mail branding introduction note.
$name = 'theme_boost_union/emailbrandingintronote';
$title = '';
$description = '<div class="alert alert-info" role="alert">'.
get_string('emailbrandingintronote', 'theme_boost_union', null, true).'</div>';
$setting = new admin_setting_description($name, $title, $description);
$tab->add($setting);
// Create E-Mail branding instruction.
$name = 'theme_boost_union/emailbrandinginstruction';
$title = '';
$description = '<h4>'.get_string('emailbrandinginstruction', 'theme_boost_union', null, true).'</h4>';
$description .= '<p>'.get_string('emailbrandinginstruction0', 'theme_boost_union', null, true).'</p>';
$emailbrandinginstructionli1url = new moodle_url('/admin/tool/customlang/index.php', array('lng' => $CFG->lang));
$description .= '<ul><li>'.get_string('emailbrandinginstructionli1', 'theme_boost_union',
array('url' => $emailbrandinginstructionli1url->out(), 'lang' => $CFG->lang), true).'</li>';
$description .= '<li>'.get_string('emailbrandinginstructionli2', 'theme_boost_union', null, true).'</li>';
$description .= '<ul><li>'.get_string('emailbrandinginstructionli2li1', 'theme_boost_union', null, true).'</li>';
$description .= '<li>'.get_string('emailbrandinginstructionli2li2', 'theme_boost_union', null, true).'</li>';
$description .= '<li>'.get_string('emailbrandinginstructionli2li3', 'theme_boost_union', null, true).'</li>';
$description .= '<li>'.get_string('emailbrandinginstructionli2li4', 'theme_boost_union', null, true).'</li></ul>';
$description .= '<li>'.get_string('emailbrandinginstructionli3', 'theme_boost_union', null, true).'</li>';
$description .= '<li>'.get_string('emailbrandinginstructionli4', 'theme_boost_union', null, true).'</li></ul>';
$description .= '<h4>'.get_string('emailbrandingpitfalls', 'theme_boost_union', null, true).'</h4>';
$description .= '<p>'.get_string('emailbrandingpitfalls0', 'theme_boost_union', null, true).'</p>';
$description .= '<ul><li>'.get_string('emailbrandingpitfallsli1', 'theme_boost_union', null, true).'</li>';
$description .= '<li>'.get_string('emailbrandingpitfallsli2', 'theme_boost_union', null, true).'</li>';
$description .= '<li>'.get_string('emailbrandingpitfallsli3', 'theme_boost_union', null, true).'</li>';
$description .= '<li>'.get_string('emailbrandingpitfallsli4', 'theme_boost_union', null, true).'</li>';
$description .= '<li>'.get_string('emailbrandingpitfallsli5', 'theme_boost_union', null, true).'</li>';
$description .= '<li>'.get_string('emailbrandingpitfallsli6', 'theme_boost_union', null, true).'</li></ul>';
$setting = new admin_setting_description($name, $title, $description);
$tab->add($setting);
// Create HTML E-Mails heading.
$name = 'theme_boost_union/emailbrandinghtmlheading';
$title = get_string('emailbrandinghtmlheading', 'theme_boost_union', null, true);
$setting = new admin_setting_heading($name, $title, null);
$tab->add($setting);
// Get HTML E-Mail preview.
$htmlpreview = theme_boost_union_get_emailbrandinghtmlpreview();
// If the HTML E-Mails are customized.
if ($htmlpreview != null) {
// Create HTML E-Mail intro.
$name = 'theme_boost_union/emailbrandinghtmlintro';
$title = '';
$description = '<div class="alert alert-info" role="alert">'.
get_string('emailbrandinghtmlintro', 'theme_boost_union', null, true).'</div>';
$setting = new admin_setting_description($name, $title, $description);
$tab->add($setting);
// Create HTML E-Mail preview.
$name = 'theme_boost_union/emailbrandinghtmlpreview';
$title = '';
$description = $htmlpreview;
$setting = new admin_setting_description($name, $title, $description);
$tab->add($setting);
// Otherwise.
} else {
// Create HTML E-Mail intro.
$name = 'theme_boost_union/emailbrandinghtmlnopreview';
$title = '';
$description = '<div class="alert alert-info" role="alert">'.
get_string('emailbrandinghtmlnopreview', 'theme_boost_union', null, true).'</div>';
$setting = new admin_setting_description($name, $title, $description);
$tab->add($setting);
}
// Create Plaintext E-Mails heading.
$name = 'theme_boost_union/emailbrandingtextheading';
$title = get_string('emailbrandingtextheading', 'theme_boost_union', null, true);
$setting = new admin_setting_heading($name, $title, null);
$tab->add($setting);
// Get Plaintext E-Mail preview.
$textpreview = theme_boost_union_get_emailbrandingtextpreview();
// If the Plaintext E-Mails are customized.
if ($textpreview != null) {
// Create Plaintext E-Mail intro.
$name = 'theme_boost_union/emailbrandingtextintro';
$title = '';
$description = '<div class="alert alert-info" role="alert">'.
get_string('emailbrandingtextintro', 'theme_boost_union', null, true).'</div>';
$setting = new admin_setting_description($name, $title, $description);
$tab->add($setting);
// Create Plaintext E-Mail preview.
$name = 'theme_boost_union/emailbrandingtextpreview';
$title = '';
$description = $textpreview;
$setting = new admin_setting_description($name, $title, $description);
$tab->add($setting);
// Otherwise.
} else {
// Create Plaintext E-Mail intro.
$name = 'theme_boost_union/emailbrandingtextnopreview';
$title = '';
$description = '<div class="alert alert-info" role="alert">'.
get_string('emailbrandingtextnopreview', 'theme_boost_union', null, true).'</div>';
$setting = new admin_setting_description($name, $title, $description);
$tab->add($setting);
}
// Add tab to settings page.
$page->add($tab);
// Create resources tab.
$tab = new admin_settingpage('theme_boost_union_look_resources',
get_string('resourcestab', 'theme_boost_union', null, true));
// Create additional resources heading.
$name = 'theme_boost_union/additionalresourcesheading';
$title = get_string('additionalresourcesheading', 'theme_boost_union', null, true);
$setting = new admin_setting_heading($name, $title, null);
$tab->add($setting);
// Setting: Additional resources.
$name = 'theme_boost_union/additionalresources';
$title = get_string('additionalresourcessetting', 'theme_boost_union', null, true);
$description = get_string('additionalresourcessetting_desc', 'theme_boost_union', null, true);
$setting = new admin_setting_configstoredfile($name, $title, $description, 'additionalresources', 0,
array('maxfiles' => -1));
$tab->add($setting);
// Information: Additional resources list.
// If there is at least one file uploaded.
if (!empty(get_config('theme_boost_union', 'additionalresources'))) {
// Prepare the widget.
$name = 'theme_boost_union/additionalresourceslist';
$title = get_string('additionalresourceslistsetting', 'theme_boost_union', null, true);
$description = get_string('additionalresourceslistsetting_desc', 'theme_boost_union', null, true).'<br /><br />'.
get_string('resourcescachecontrolnote', 'theme_boost_union', null, true);
// Append the file list to the description.
$templatecontext = array('files' => theme_boost_union_get_additionalresources_templatecontext());
$description .= $OUTPUT->render_from_template('theme_boost_union/settings-additionalresources-filelist',
$templatecontext);
// Finish the widget.
$setting = new admin_setting_description($name, $title, $description);
$tab->add($setting);
}
// Create custom fonts heading.
$name = 'theme_boost_union/customfontsheading';
$title = get_string('customfontsheading', 'theme_boost_union', null, true);
$setting = new admin_setting_heading($name, $title, null);
$tab->add($setting);
// Register the webfonts file types for filtering the uploads in the subsequent admin settings.
// This function call may return false. In this case, the filetypes were not registered and we
// can't restrict the filetypes in the subsequent admin settings unfortunately.
$registerfontsresult = theme_boost_union_register_webfonts_filetypes();
// Setting: Custom fonts.
$name = 'theme_boost_union/customfonts';
$title = get_string('customfontssetting', 'theme_boost_union', null, true);
$description = get_string('customfontssetting_desc', 'theme_boost_union', null, true);
if ($registerfontsresult == true) {
$setting = new admin_setting_configstoredfile($name, $title, $description, 'customfonts', 0,
array('maxfiles' => -1, 'accepted_types' => theme_boost_union_get_webfonts_extensions()));
} else {
$setting = new admin_setting_configstoredfile($name, $title, $description, 'customfonts', 0,
array('maxfiles' => -1));
}
$tab->add($setting);
// Information: Custom fonts list.
// If there is at least one file uploaded.
if (!empty(get_config('theme_boost_union', 'customfonts'))) {
// Prepare the widget.
$name = 'theme_boost_union/customfontslist';
$title = get_string('customfontslistsetting', 'theme_boost_union', null, true);
$description = get_string('customfontslistsetting_desc', 'theme_boost_union', null, true);
// Append the file list to the description.
$templatecontext = array('files' => theme_boost_union_get_customfonts_templatecontext());
$description .= $OUTPUT->render_from_template('theme_boost_union/settings-customfonts-filelist', $templatecontext);
// Finish the widget.
$setting = new admin_setting_description($name, $title, $description);
$tab->add($setting);
}
// Create FontAwesome heading.
$name = 'theme_boost_union/fontawesomeheading';
$title = get_string('fontawesomeheading', 'theme_boost_union', null, true);
$setting = new admin_setting_heading($name, $title, null);
$tab->add($setting);
// Setting: FontAwesome version.
$faversionoption =
// Don't use string lazy loading (= false) because the string will be directly used and would produce a
// PHP warning otherwise.
array(THEME_BOOST_UNION_SETTING_FAVERSION_NONE =>
get_string('fontawesomeversionnone', 'theme_boost_union', null, false),
THEME_BOOST_UNION_SETTING_FAVERSION_FA6FREE =>
get_string('fontawesomeversionfa6free', 'theme_boost_union', null, false));
$name = 'theme_boost_union/fontawesomeversion';
$title = get_string('fontawesomeversionsetting', 'theme_boost_union', null, true);
$description = get_string('fontawesomeversionsetting_desc', 'theme_boost_union', null, true);
$setting = new admin_setting_configselect($name, $title, $description, THEME_BOOST_UNION_SETTING_FAVERSION_NONE,
$faversionoption);
$setting->set_updatedcallback('theme_boost_union_fontawesome_checkin');
$tab->add($setting);
// Setting: FontAwesome files.
$name = 'theme_boost_union/fontawesomefiles';
$title = get_string('fontawesomefilessetting', 'theme_boost_union', null, true);
$description = get_string('fontawesomefilessetting_desc', 'theme_boost_union', null, true).'<br /><br />'.
get_string('fontawesomefilesstructurenote', 'theme_boost_union', null, true);
if ($registerfontsresult == true) {
// Use our enhanced implementation of admin_setting_configstoredfile to circumvent MDL-59082.
// This can be changed back to admin_setting_configstoredfile as soon as MDL-59082 is fixed.
$setting = new admin_setting_configstoredfilealwayscallback($name, $title, $description, 'fontawesome', 0,
array('maxfiles' => -1, 'subdirs' => 1, 'accepted_types' => theme_boost_union_get_fontawesome_extensions()));
} else {
// Use our enhanced implementation of admin_setting_configstoredfile to circumvent MDL-59082.
// This can be changed back to admin_setting_configstoredfile as soon as MDL-59082 is fixed.
$setting = new admin_setting_configstoredfilealwayscallback($name, $title, $description, 'fontawesome', 0,
array('maxfiles' => -1));
}
$setting->set_updatedcallback('theme_boost_union_fontawesome_checkin');
$tab->add($setting);
$page->hide_if('theme_boost_union/fontawesomefiles', 'theme_boost_union/fontawesomeversion', 'eq',
THEME_BOOST_UNION_SETTING_FAVERSION_NONE);
// Information: FontAwesome list.
$faconfig = get_config('theme_boost_union', 'fontawesomeversion');
// If there is at least one file uploaded and if a FontAwesome version is enabled (unfortunately, hide_if does not
// work for admin_setting_description up to now, that's why we have to use this workaround).
if ($faconfig != THEME_BOOST_UNION_SETTING_FAVERSION_NONE && $faconfig != null &&
!empty(get_config('theme_boost_union', 'fontawesomefiles'))) {
// Prepare the widget.
$name = 'theme_boost_union/fontawesomelist';
$title = get_string('fontawesomelistsetting', 'theme_boost_union', null, true);
$description = get_string('fontawesomelistsetting_desc', 'theme_boost_union', null, true).'<br /><br />'.
get_string('fontawesomelistnote', 'theme_boost_union', null, true);
// Append the file list to the description.
$templatecontext = array('files' => theme_boost_union_get_fontawesome_templatecontext());
$description .= $OUTPUT->render_from_template('theme_boost_union/settings-fontawesome-filelist', $templatecontext);
// Finish the widget.
$setting = new admin_setting_description($name, $title, $description);
$tab->add($setting);
}
// Information: FontAwesome checks.
// If there is at least one file uploaded and if a FontAwesome version is enabled (unfortunately, hide_if does not
// work for admin_setting_description up to now, that's why we have to use this workaround).
if ($faconfig != THEME_BOOST_UNION_SETTING_FAVERSION_NONE && $faconfig != null &&
!empty(get_config('theme_boost_union', 'fontawesomefiles'))) {
// Prepare the widget.
$name = 'theme_boost_union/fontawesomechecks';
$title = get_string('fontawesomecheckssetting', 'theme_boost_union', null, true);
$description = get_string('fontawesomecheckssetting_desc', 'theme_boost_union', null, true);
// Append the checks to the description.
$templatecontext = array('checks' => theme_boost_union_get_fontawesome_checks_templatecontext());
$description .= $OUTPUT->render_from_template('theme_boost_union/settings-fontawesome-checks', $templatecontext);
// Finish the widget.
$setting = new admin_setting_description($name, $title, $description);
$tab->add($setting);
}
// Add tab to settings page.
$page->add($tab);
// Create H5P tab.
$tab = new admin_settingpage('theme_boost_union_look_h5p',
get_string('h5ptab', 'theme_boost_union', null, true));
// Create Raw CSS for H5P heading.
$name = 'theme_boost_union/cssh5pheading';
$title = get_string('cssh5pheading', 'theme_boost_union', null, true);
$setting = new admin_setting_heading($name, $title, null);
$tab->add($setting);
// Setting: Raw CSS for H5P.
$name = 'theme_boost_union/cssh5p';
$title = get_string('cssh5psetting', 'theme_boost_union', null, true);
$description = get_string('cssh5psetting_desc', 'theme_boost_union', null, true);
$default = '';
$setting = new admin_setting_scsscode($name, $title, $description, $default, PARAM_RAW);
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Create content bank width heading.
$name = 'theme_boost_union/contentwidthheading';
$title = get_string('contentwidthheading', 'theme_boost_union', null, true);
$setting = new admin_setting_heading($name, $title, null);
$tab->add($setting);
// Setting: H5P content bank max width.
$name = 'theme_boost_union/h5pcontentmaxwidth';
$title = get_string('h5pcontentmaxwidthsetting', 'theme_boost_union', null, true);
$description = get_string('h5pcontentmaxwidthsetting_desc', 'theme_boost_union', null, true);
$default = '960px';
$setting = new admin_setting_configtext($name, $title, $description, $default, $widthregex, 6);
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Add tab to settings page.
$page->add($tab);
// Create mobile app tab.
$tab = new admin_settingpage('theme_boost_union_look_mobile',
get_string('mobiletab', 'theme_boost_union', null, true));
// Create Mobile appearance heading.
$name = 'theme_boost_union/mobileappearanceheading';
$title = get_string('mobileappearanceheading', 'theme_boost_union', null, true);
$setting = new admin_setting_heading($name, $title, null);
$tab->add($setting);
// Setting: Additional CSS for Mobile app.
$name = 'theme_boost_union/mobilescss';
$title = get_string('mobilecss', 'theme_boost_union', null, true);
$description = get_string('mobilecss_desc', 'theme_boost_union', null, true);
$mobilecssurl = new moodle_url('/admin/settings.php', array('section' => 'mobileappearance'));
// If another Mobile App CSS URL is set already (in the $CFG->mobilecssurl setting), we add a warning to the description.
if (isset($CFG->mobilecssurl) && !empty($CFG->mobilecssurl) &&
strpos($CFG->mobilecssurl, '/boost_union/mobile/styles.php') == false) {
$mobilescssnotification = new \core\output\notification(
get_string('mobilecss_overwrite', 'theme_boost_union',
array('url' => $mobilecssurl->out(), 'value' => $CFG->mobilecssurl)).' '.
get_string('mobilecss_donotchange', 'theme_boost_union'),
\core\output\notification::NOTIFY_WARNING);
$mobilescssnotification->set_show_closebutton(false);
$description .= $OUTPUT->render($mobilescssnotification);
// Otherwise, we just add a note to the description.
} else {
$mobilescssnotification = new \core\output\notification(
get_string('mobilecss_set', 'theme_boost_union',
array('url' => $mobilecssurl->out())).' '.
get_string('mobilecss_donotchange', 'theme_boost_union'),
\core\output\notification::NOTIFY_INFO);
$mobilescssnotification->set_show_closebutton(false);
$description .= $OUTPUT->render($mobilescssnotification);
}
// Using admin_setting_scsscode is not 100% right here as this setting does not support SCSS.
// However, is shouldn't harm if the CSS code is parsed by the setting.
$setting = new admin_setting_scsscode($name, $title, $description, '', PARAM_RAW);
$setting->set_updatedcallback('theme_boost_union_set_mobilecss_url');
$tab->add($setting);
// Add tab to settings page.
$page->add($tab);
// Add settings page to the admin settings category.
$ADMIN->add('theme_boost_union', $page);
// Create Feel settings page with tabs
// (and allow users with the theme/boost_union:configure capability to access it).
$page = new theme_boost_admin_settingspage_tabs('theme_boost_union_feel',
get_string('configtitlefeel', 'theme_boost_union', null, true),
'theme/boost_union:configure');
// Create navigation tab.
$tab = new admin_settingpage('theme_boost_union_feel_navigation',
get_string('navigationtab', 'theme_boost_union', null, true));
// Create primary navigation heading.
$name = 'theme_boost_union/primarynavigationheading';
$title = get_string('primarynavigationheading', 'theme_boost_union', null, true);
$setting = new admin_setting_heading($name, $title, null);
$tab->add($setting);
// Prepare hide nodes options.
$hidenodesoptions = array(
THEME_BOOST_UNION_SETTING_HIDENODESPRIMARYNAVIGATION_HOME => get_string('home'),
THEME_BOOST_UNION_SETTING_HIDENODESPRIMARYNAVIGATION_MYHOME => get_string('myhome'),
THEME_BOOST_UNION_SETTING_HIDENODESPRIMARYNAVIGATION_MYCOURSES => get_string('mycourses'),
THEME_BOOST_UNION_SETTING_HIDENODESPRIMARYNAVIGATION_SITEADMIN => get_string('administrationsite')
);
// Setting: Hide nodes in primary navigation.
$name = 'theme_boost_union/hidenodesprimarynavigation';
$title = get_string('hidenodesprimarynavigationsetting', 'theme_boost_union', null, true);
$description = get_string('hidenodesprimarynavigationsetting_desc', 'theme_boost_union', null, true);
$setting = new admin_setting_configmulticheckbox($name, $title, $description, array(), $hidenodesoptions);
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Create navigation heading.
$name = 'theme_boost_union/navigationheading';
$title = get_string('navigationheading', 'theme_boost_union', null, true);
$setting = new admin_setting_heading($name, $title, null);
$tab->add($setting);
// Setting: back to top button.
$name = 'theme_boost_union/backtotopbutton';
$title = get_string('backtotopbuttonsetting', 'theme_boost_union', null, true);
$description = get_string('backtotopbuttonsetting_desc', 'theme_boost_union', null, true);
$setting = new admin_setting_configselect($name, $title, $description, THEME_BOOST_UNION_SETTING_SELECT_NO, $yesnooption);
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Setting: scroll-spy.
$name = 'theme_boost_union/scrollspy';
$title = get_string('scrollspysetting', 'theme_boost_union', null, true);
$description = get_string('scrollspysetting_desc', 'theme_boost_union', null, true);
$setting = new admin_setting_configselect($name, $title, $description, THEME_BOOST_UNION_SETTING_SELECT_NO, $yesnooption);
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Setting: Activity navigation.
$name = 'theme_boost_union/activitynavigation';
$title = get_string('activitynavigationsetting', 'theme_boost_union', null, true);
$description = get_string('activitynavigationsetting_desc', 'theme_boost_union', null, true);
$setting = new admin_setting_configselect($name, $title, $description, THEME_BOOST_UNION_SETTING_SELECT_NO, $yesnooption);
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);
// Add tab to settings page.
$page->add($tab);
// Create blocks tab.
$tab = new admin_settingpage('theme_boost_union_feel_blocks', get_string('blockstab', 'theme_boost_union', null, true));
// Create blocks general heading.
$name = 'theme_boost_union/blocksgeneralheading';
$title = get_string('blocksgeneralheading', 'theme_boost_union', null, true);
$setting = new admin_setting_heading($name, $title, null);
$tab->add($setting);
// Replicate the Unaddable blocks setting from theme_boost.
$name = 'theme_boost_union/unaddableblocks';
$title = get_string('unaddableblocks', 'theme_boost', null, true);
$description = get_string('unaddableblocks_desc', 'theme_boost', null, true);
$default = 'navigation,settings,course_list,section_links';
$setting = new admin_setting_configtext($name, $title, $description, $default, PARAM_TEXT);