Skip to content

Commit

Permalink
MDL-50661 theme_more: New small logo setting
Browse files Browse the repository at this point in the history
Adding required bits so theme_more can also set a small logo.
  • Loading branch information
David Monllao committed Nov 30, 2015
1 parent c08b52a commit 52d57db
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 3 deletions.
5 changes: 5 additions & 0 deletions theme/more/lang/en/theme_more.php
Expand Up @@ -72,6 +72,11 @@
$string['region-side-pre'] = 'Left';
$string['secondarybackground'] = 'Secondary background colour';
$string['secondarybackground_desc'] = 'The background colour of any secondary content, such as blocks.';
$string['sitelogo'] = 'Site logo';
$string['sitename'] = 'Display site name along with small logo';
$string['sitenamedesc'] = 'This setting is only applied if a "Small logo" is set. If no small logo is set the site name is always displayed in the navigation bar, but if it is you can use this setting to display it or not.';
$string['smalllogo'] = 'Small logo';
$string['smalllogodesc'] = 'This logo is displayed in the navbar next to the site name, if a "Logo" is set, then it is only displayed on the pages where the logo is not displayed.';
$string['textcolor'] = 'Text colour';
$string['textcolor_desc'] = 'The colour of the text.';

3 changes: 2 additions & 1 deletion theme/more/lib.php
Expand Up @@ -147,7 +147,8 @@ function theme_more_set_logo($css, $logo) {
* @return bool
*/
function theme_more_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) {
if ($context->contextlevel == CONTEXT_SYSTEM && ($filearea === 'logo' || $filearea === 'backgroundimage')) {
if ($context->contextlevel == CONTEXT_SYSTEM &&
($filearea === 'logo' || $filearea === 'smalllogo' || $filearea === 'backgroundimage')) {
$theme = theme_config::load('more');
// By default, theme files must be cache-able by both browsers and proxies.
if (!array_key_exists('cacheability', $options)) {
Expand Down
16 changes: 16 additions & 0 deletions theme/more/settings.php
Expand Up @@ -149,6 +149,22 @@
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);

// Small logo file setting.
$name = 'theme_more/smalllogo';
$title = get_string('smalllogo', 'theme_more');
$description = get_string('smalllogodesc', 'theme_more');
$setting = new admin_setting_configstoredfile($name, $title, $description, 'smalllogo');
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);

// Show site name along with small logo.
$name = 'theme_more/sitename';
$title = get_string('sitename', 'theme_more');
$description = get_string('sitenamedesc', 'theme_more');
$setting = new admin_setting_configcheckbox($name, $title, $description, 1);
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);

// Custom CSS file.
$name = 'theme_more/customcss';
$title = get_string('customcss', 'theme_more');
Expand Down
31 changes: 31 additions & 0 deletions theme/more/style/custom.css
Expand Up @@ -16,6 +16,37 @@ div.logo {
float: right;
}

img.small-logo {
float: left;
height: 35px;
margin: 3px 10px 3px 0;
}

.dir-rtl img.small-logo {
float: right;
margin: 3px 0 3px 10px;
}

@media (max-width: 767px) {
.dir-rtl img.small-logo,
img.small-logo {
margin: 3px;
}
}

@media (max-width: 480px) {
.navbar img.small-logo {
max-width: 150px;
}
/* Applying accesshide styles */
.navbar .small-logo-container + .brand {
position: absolute;
left: -10000px;
font-size: 1em;
font-weight: normal;
}
}

/* Custom CSS Settings
-------------------------*/
[[setting:customcss]]
4 changes: 2 additions & 2 deletions theme/more/version.php
Expand Up @@ -24,10 +24,10 @@

defined('MOODLE_INTERNAL') || die;

$plugin->version = 2015111600;
$plugin->version = 2015111601;
$plugin->requires = 2015111000;
$plugin->component = 'theme_more';
$plugin->dependencies = array(
'theme_bootstrapbase' => 2015111000,
'theme_clean' => 2015111000,
'theme_clean' => 2015111601,
);

0 comments on commit 52d57db

Please sign in to comment.