Skip to content
Snippets Groups Projects
Commit fd85c2b2 authored by Kathrin Osswald's avatar Kathrin Osswald
Browse files

Added setting to be able to add additional resources to the theme.

parent 7b17305c
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,10 @@ moodle-theme_boost_campus
Changes
-------
### Unreleased
* 2019-05-02 - Added setting to be able to add additional resources to the theme.
### Release v3.6-r4
* 2019-04-26 - Fixed some fixable prechecker warnings.
......
......@@ -325,6 +325,17 @@ This is because the breakpoint is set to [media-breakpoint-down(lg)](https://get
If you think there is enough space to show the content plus the blocks column side by side on a screen width of 992 pixels and up, then enable this setting. It will change the breakpoint to media-breakpoint-down(md). This will break the blocks column only on screens with widths of less than 992 pixels.
#### Additional resources
##### Add additional resources
With this setting you can upload additional resources to the theme. You can reference these resources by using a link.
The advantage of uploading files to this file area is that those files can be delivered without a check if the user is logged in. This is also why you should only add files that are uncritical and everyone should be allowed to access and don't need be protected with a valid login.
Use case and usage example:
We're using the footer blocks setting and some of the blocks are displaying an image that was added to the HTML block. When a newly registered user logs in, he will be redirected to the policy page (user/policy.php). The footer blocks are displayed on this page layout and because the HTML block will only deliver its resources after the user is logged in and accepted the user policy, the delivering will be prevented and the redirect is saved to this resource. This leads to the behavior that after accepting the policy the resource was displayed and not the Dashbaord as intended.
With this setting, the image (e.g. htmlblockimage.png) that should be displayed in the block could be added to this file area and added as a link with the url "/pluginfile.php/1/theme_boost_campus/additionalresources/0/htmlblockimage.png".
Further improvements to Boost core theme
----------------------------------------
......
......@@ -204,6 +204,12 @@ $string['breakpointsetting'] = 'Change breakpoint';
$string['breakpointsetting_desc'] = 'In theme Boost, the right block column will break down even on devices with a width up to 1200 pixels (widescreen resolution of the iPad is 1024 pixels, for example).
This is because the breakpoint is set to <a href="https://getbootstrap.com/docs/4.0/layout/overview/#responsive-breakpoints">media-breakpoint-down(lg)</a>. <br/>
If you think there is enough space to show the content plus the blocks column side by side on a screen width of 992 pixels and up, then enable this setting. It will change the breakpoint to media-breakpoint-down(md). This will break the blocks column only on screens with widths of less than 992 pixels.';
// ...Additional resources.
$string['additionalresourcesheadingsetting'] = 'Additional resources';
$string['additionalresourcessetting'] = 'Add additional resources';
$string['additionalresourcessetting_desc'] = 'With this setting you can upload additional resources to the theme. You can reference these resources by using a link. The url will look like this: "/pluginfile.php/1/theme_boost_campus/additionalresources/0/yourfilename.someextention"<br/>
The advantage of uploading files to this file area is that those files can be delivered without a check if the user is logged in. This is also why you should only add files that are uncritical and everyone should be allowed to access and don\'t need be protected with a valid login. <br/>
An example for a use case can be found in the README.md file.';
// ADDITIONAL STRINGS (IN ALPHABETICAL ORDER).
$string['cachedef_imagearea'] = 'Cache for imagearea items';
......
......@@ -173,6 +173,8 @@ function theme_boost_campus_pluginfile($course, $cm, $context, $filearea, $args,
return $theme->setting_file_serve('fontfiles', $args, $forcedownload, $options);
} else if ($filearea === 'imageareaitems') {
return $theme->setting_file_serve('imageareaitems', $args, $forcedownload, $options);
} else if ($filearea === 'additionalresources') {
return $theme->setting_file_serve('additionalresources', $args, $forcedownload, $options);
} else {
send_file_not_found();
}
......
......@@ -649,6 +649,21 @@ if ($ADMIN->fulltree) {
$setting->set_updatedcallback('theme_reset_all_caches');
$page->add($setting);
// Settings title to group additional resources settings together with a common heading. We don't want a description here.
$name = 'theme_boost_campus/additionalresourcesheading';
$title = get_string('additionalresourcesheadingsetting', 'theme_boost_campus', null, true);
$setting = new admin_setting_heading($name, $title, null);
$page->add($setting);
// Background image setting.
$name = 'theme_boost_campus/additionalresources';
$title = get_string('additionalresourcessetting', 'theme_boost_campus', null, true);
$description = get_string('additionalresourcessetting_desc', 'theme_boost_campus', null, true);
$setting = new admin_setting_configstoredfile($name, $title, $description, 'additionalresources', 0,
array('maxfiles' => -1));
$setting->set_updatedcallback('theme_reset_all_caches');
$page->add($setting);
// Add tab to settings page.
$settings->add($page);
}
......@@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'theme_boost_campus';
$plugin->version = 2019043000;
$plugin->version = 2019050200;
$plugin->release = 'v3.6-r4';
$plugin->requires = 2018120300;
$plugin->maturity = MATURITY_STABLE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment