Merge branch 'MDL-72981-master-2' of https://github.com/bmbrands/moodle

This commit is contained in:
Sara Arjona
2021-12-09 12:01:09 +01:00
5 changed files with 8 additions and 45 deletions
+4 -22
View File
@@ -386,17 +386,18 @@ class renderer_base {
*/
public function should_display_navbar_logo() {
$logo = $this->get_compact_logo_url();
return !empty($logo) && !$this->should_display_main_logo();
return !empty($logo);
}
/**
* Whether we should display the main logo.
*
* @deprecated since Moodle 4.0
* @todo final deprecation. To be removed in Moodle 4.4 MDL-73165.
* @param int $headinglevel The heading level we want to check against.
* @return bool
*/
public function should_display_main_logo($headinglevel = 1) {
debugging('should_display_main_logo() is deprecated and will be removed in Moodle 4.4.', DEBUG_DEVELOPER);
// Only render the logo if we're on the front page or login page and the we have a logo.
$logo = $this->get_logo_url();
if ($headinglevel == 1 && !empty($logo)) {
@@ -4265,25 +4266,6 @@ EOD;
}
}
if ($this->should_display_main_logo($headinglevel)) {
$sitename = format_string($SITE->fullname, true, ['context' => context_course::instance(SITEID)]);
// Logo.
$html = html_writer::div(
html_writer::empty_tag('img', [
'src' => $this->get_logo_url(null, 150),
'alt' => get_string('logoof', '', $sitename),
'class' => 'img-fluid'
]),
'logo'
);
// Heading.
if (!isset($heading)) {
$html .= $this->heading($this->page->heading, $headinglevel, 'sr-only');
} else {
$html .= $this->heading($heading, $headinglevel, 'sr-only');
}
return $html;
}
$contextheader = new context_header($heading, $headinglevel, $imagedata, $userbuttons);
return $this->render_context_header($contextheader);
+1
View File
@@ -2,6 +2,7 @@ This files describes API changes in core libraries and APIs,
information provided here is intended especially for developers.
=== 4.0 ===
* The $OUTPUT->should_display_main_logo() function has been deprecated and should no longer be used.
* New method flexible_table::set_columnsattributes() has been introduced to add column attributes applied in every cell.
* New method flexible_table::get_row_cells_html() has been introduced, extracted from flexible_table::get_row_html
so it can be overriden individually.
@@ -98,9 +98,6 @@ class context_header implements \renderable, \templatable {
*/
protected function get_logo_data(\renderer_base $output): array {
global $SITE;
if (!$output->should_display_main_logo($this->headinglevel)) {
return [];
}
$sitename = format_string($SITE->fullname, true, ['context' => \context_course::instance(SITEID)]);
if (!isset($heading)) {
@@ -155,25 +155,6 @@ class core_renderer extends \core_renderer {
$prefix = get_string('modulename', $this->page->activityname);
}
if ($this->should_display_main_logo($headinglevel)) {
$sitename = format_string($SITE->fullname, true, ['context' => \context_course::instance(SITEID)]);
// Logo.
$html = html_writer::div(
html_writer::empty_tag('img', [
'src' => $this->get_logo_url(null, 150),
'alt' => get_string('logoof', '', $sitename),
'class' => 'img-fluid'
]),
'logo'
);
// Heading.
if (!isset($heading)) {
$html .= $this->heading($this->page->heading, $headinglevel, 'sr-only');
} else {
$html .= $this->heading($heading, $headinglevel, 'sr-only');
}
return $html;
}
$contextheader = new \context_header($heading, $headinglevel, $imagedata, $userbuttons, $prefix);
return $this->render_context_header($contextheader);
+3 -1
View File
@@ -42,7 +42,9 @@
{{# output.should_display_navbar_logo }}
<img src="{{output.get_compact_logo_url}}" class="logo mr-1" alt="{{sitename}}">
{{/ output.should_display_navbar_logo }}
{{{ sitename }}}
{{^ output.should_display_navbar_logo }}
{{{ sitename }}}
{{/ output.should_display_navbar_logo }}
</a>
<ul class="navbar-nav d-none d-md-flex">