|
27 | 27 | use theme_boost_union\admin_setting_configtext_url;
|
28 | 28 | use theme_boost_union\admin_settingspage_tabs_with_external;
|
29 | 29 | use theme_boost_union\admin_externalpage_in_tab;
|
| 30 | +use theme_boost_union\snippets; |
30 | 31 | use core\di;
|
31 | 32 | use core\hook\manager as hook_manager;
|
32 | 33 |
|
|
2858 | 2859 | $setting->set_updatedcallback('theme_reset_all_caches');
|
2859 | 2860 | $tab->add($setting);
|
2860 | 2861 |
|
| 2862 | + // Create uploaded snippets heading. |
| 2863 | + $name = 'theme_boost_union/uploadedsnippetsheading'; |
| 2864 | + $title = get_string('snippetsuploadedsnippetsheading', 'theme_boost_union', null, true); |
| 2865 | + $setting = new admin_setting_heading($name, $title, null); |
| 2866 | + $tab->add($setting); |
| 2867 | + |
| 2868 | + // Setting: Enable uploaded snippets. |
| 2869 | + $name = 'theme_boost_union/enableuploadedsnippets'; |
| 2870 | + $title = get_string('enableuploadedsnippets', 'theme_boost_union', null, true); |
| 2871 | + $description = get_string('enableuploadedsnippets_desc', 'theme_boost_union', null, true); |
| 2872 | + $setting = new admin_setting_configselect($name, $title, $description, THEME_BOOST_UNION_SETTING_SELECT_NO, $yesnooption); |
| 2873 | + $setting->set_updatedcallback('theme_reset_all_caches'); |
| 2874 | + $tab->add($setting); |
| 2875 | + |
| 2876 | + // Setting: Uploaded snippets. |
| 2877 | + $name = 'theme_boost_union/uploadedsnippets'; |
| 2878 | + $title = get_string('uploadedsnippets', 'theme_boost_union', null, true); |
| 2879 | + $snippetrepourl = 'https://github.com/moodle-an-hochschulen/moodle-theme_boost_union_snippets'; |
| 2880 | + $description = get_string('uploadedsnippets_desc', 'theme_boost_union', ['url' => $snippetrepourl], true); |
| 2881 | + $uploadedsnippetsextensions = array_map(function($item) { |
| 2882 | + return '.'.$item; |
| 2883 | + }, snippets::ALLOWED_PREVIEW_FILE_EXTENSIONS);; |
| 2884 | + $uploadedsnippetsextensions[] = '.scss'; |
| 2885 | + $setting = new admin_setting_configstoredfile($name, $title, $description, 'snippets', 0, |
| 2886 | + ['maxfiles' => -1, 'subdirs' => 0, 'accepted_types' => $uploadedsnippetsextensions]); |
| 2887 | + $tab->add($setting); |
| 2888 | + $page->hide_if('theme_boost_union/uploadedsnippets', 'theme_boost_union/enableuploadedsnippets', 'neq', |
| 2889 | + THEME_BOOST_UNION_SETTING_SELECT_YES); |
| 2890 | + |
2861 | 2891 | // Add tab to settings page.
|
2862 | 2892 | $page->add($tab);
|
2863 | 2893 |
|
|
0 commit comments