From 3b419c4540f805ec26b6332a2b89bd46d3557581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikel=20Mart=C3=ADn?= Date: Tue, 11 Jun 2024 12:02:07 +0200 Subject: [PATCH] MDL-82160 renderer: Add render_context_header method to core_renderer In MDL-81597 the original render_context_header method was removed and converted to a template. That caused a regression, so this patch adds the method again but using the new template. --- .upgradenotes/MDL-82160-2024061112162023.yml | 7 +++++++ lib/outputrenderers.php | 14 ++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 .upgradenotes/MDL-82160-2024061112162023.yml diff --git a/.upgradenotes/MDL-82160-2024061112162023.yml b/.upgradenotes/MDL-82160-2024061112162023.yml new file mode 100644 index 00000000000..06c5fbf8b12 --- /dev/null +++ b/.upgradenotes/MDL-82160-2024061112162023.yml @@ -0,0 +1,7 @@ +issueNumber: MDL-82160 +notes: + theme: + - message: >- + The method `core_renderer::render_context_header` has been deprecated + please use core_renderer::render($contextheader) instead + type: deprecated diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 918db5ec79d..7b2e19354bb 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -4601,6 +4601,20 @@ EOD; return $this->render($contextheader); } + /** + * Renders the header bar. + * + * @param context_header $contextheader Header bar object. + * @return string HTML for the header bar. + * @deprecated since 4.5 Please use core_renderer::render($contextheader) instead + * @todo MDL-82163 This will be deleted in Moodle 6.0. + */ + #[\core\attribute\deprecated('core_renderer::render($contextheader)', since: '4.5', mdl: 'MDL-82160')] + protected function render_context_header(context_header $contextheader) { + $context = $contextheader->export_for_template($this); + return $this->render_from_template('core/context_header', $context); + } + /** * Renders the skip links for the page. *