mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-49536 theme_clean: logo only on front and login
The logo for the clean and more themes will only be displayed on the front page and login page as it was replacing the header information on other pages within Moodle, causing users to lose information on the page.
This commit is contained in:
parent
6d392b3027
commit
6ceea3fe12
2 changed files with 25 additions and 2 deletions
|
@ -38,9 +38,30 @@ class theme_clean_core_renderer extends theme_bootstrapbase_core_renderer {
|
||||||
* @return string HTML for the header bar.
|
* @return string HTML for the header bar.
|
||||||
*/
|
*/
|
||||||
public function context_header($headerinfo = null, $headinglevel = 1) {
|
public function context_header($headerinfo = null, $headinglevel = 1) {
|
||||||
if ($headinglevel == 1 && !empty($this->page->theme->settings->logo)) {
|
|
||||||
|
if ($this->should_render_logo($headinglevel)) {
|
||||||
return html_writer::tag('div', '', array('class' => 'logo'));
|
return html_writer::tag('div', '', array('class' => 'logo'));
|
||||||
}
|
}
|
||||||
return parent::context_header($headerinfo, $headinglevel);
|
return parent::context_header($headerinfo, $headinglevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines if we should render the logo.
|
||||||
|
*
|
||||||
|
* @param int $headinglevel What level the 'h' tag will be.
|
||||||
|
* @return bool Should the logo be rendered.
|
||||||
|
*/
|
||||||
|
protected function should_render_logo($headinglevel = 1) {
|
||||||
|
global $PAGE;
|
||||||
|
|
||||||
|
// Only render the logo if we're on the front page or login page
|
||||||
|
// and the theme has a logo.
|
||||||
|
if ($headinglevel == 1 && !empty($this->page->theme->settings->logo)) {
|
||||||
|
if ($PAGE->pagelayout == 'frontpage' || $PAGE->pagelayout == 'login') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,9 @@ function theme_clean_get_html_for_settings(renderer_base $output, moodle_page $p
|
||||||
$return->navbarclass .= ' navbar-inverse';
|
$return->navbarclass .= ' navbar-inverse';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($page->theme->settings->logo)) {
|
// Only display the logo on the front page and login page, if one is defined.
|
||||||
|
if (!empty($page->theme->settings->logo) &&
|
||||||
|
($page->pagelayout == 'frontpage' || $page->pagelayout == 'login')) {
|
||||||
$return->heading = html_writer::tag('div', '', array('class' => 'logo'));
|
$return->heading = html_writer::tag('div', '', array('class' => 'logo'));
|
||||||
} else {
|
} else {
|
||||||
$return->heading = $output->page_heading();
|
$return->heading = $output->page_heading();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue