Skip to content

Commit

Permalink
finalizing the feature moodle-an-hochschulen#544
Browse files Browse the repository at this point in the history
  • Loading branch information
DocDanou committed May 14, 2024
1 parent a850a63 commit 8d95dc5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion lang/en/theme_boost_union.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
// ... Section: Navbar.
$string['navbarheading'] = 'Navbar';
// ... Section: Navbar logo max width.
$string['maxlogowidth'] = 'Maximal width of header logo if it should be limited';
$string['maxlogowidth'] = 'Maximal width of header logo, if it should be limited';
$string['maxlogowidth_desc'] = 'If the logo is too broad or has and special aspect ratio, you can set the maximal width of the logo in the navbar header. Use CSS notation. Possible values can have some digits and end with `px`, `%`, `vw` or the field can be left empty if you do not want to use this setting.';
// ... ... Setting: Navbar color.
$string['navbarcolorsetting'] = 'Navbar color';
Expand Down
4 changes: 4 additions & 0 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ function theme_boost_union_get_pre_scss($theme) {
if (get_config('theme_boost_union', 'blockdrawerwidth')) {
$scss .= '$drawer-right-width: '.get_config('theme_boost_union', 'blockdrawerwidth').";\n";
}
// Set variables which are read in settings by the logo maxwidth values. #544
if (get_config('theme_boost_union', 'maxlogowidth')) {
$scss .= '.navbar img.logo{max-width:'.get_config('theme_boost_union', 'maxlogowidth').";}\n";
}

// Set custom Boost Union SCSS variable: The block region outside left width.
$blockregionoutsideleftwidth = get_config('theme_boost_union', 'blockregionoutsideleftwidth');
Expand Down
24 changes: 12 additions & 12 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,25 +261,25 @@
$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,
['maxfiles' => 1, 'accepted_types' => 'web_image']);
$setting->set_updatedcallback('theme_reset_all_caches');
$tab->add($setting);

// Setting: add extra SCSS if logo icon is too broad / wrong aspect ratio. See Issue-544.
// DANOU - MT-4714
$name = 'theme_boost_union/maxlogowidth';
$title = get_string('maxlogowidth', 'theme_boost_union', null, true);
$description = get_string('maxlogowidth_desc', 'theme_boost_union', null, true);
$default = '';
// 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). Additional the field can be left blank.
$widthregex = '/^((\d{1,2}|100)%)|((\d{1,2}|100)vw)|(\d{3,4}px)|(^(?!.*\S))$/';
$setting = new admin_setting_configtext($name, $title, $description, $default, $widthregex, 6);
$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,
['maxfiles' => 1, 'accepted_types' => 'web_image']);
$setting->set_updatedcallback('theme_reset_all_caches');
// (with 2 or 3 digits) or a viewport width number (from 0 to 100). Additionally the field can be left blank.
$maxlogowidthregex = '/^((\d{1,2}|100)%)|((\d{1,2}|100)vw)|(\d{2,3}px)|(^(?!.*\S))$/';
$setting = new admin_setting_configtext($name, $title, $description, $default, $maxlogowidthregex, 6);
$tab->add($setting);

// Create favicon heading.
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();

$plugin->component = 'theme_boost_union';
$plugin->version = 2024051300;
$plugin->version = 2024051400;
$plugin->release = 'v4.3-r12';
$plugin->requires = 2023100900;
$plugin->supported = [403, 403];
Expand Down

0 comments on commit 8d95dc5

Please sign in to comment.