MDL-63040 core_my: Remove page header
authorPeter <peter@moodle.com>
Tue, 9 Oct 2018 05:00:42 +0000 (13:00 +0800)
committerPeter <peter@moodle.com>
Fri, 12 Oct 2018 00:12:46 +0000 (08:12 +0800)
* Remove user name and image from the page header
* Modify header template to accept new fields

lib/outputrenderers.php
theme/boost/config.php
theme/boost/scss/moodle/core.scss
theme/boost/templates/header.mustache
theme/bootstrapbase/config.php

index a074857..5e62494 100644 (file)
@@ -4245,6 +4245,11 @@ EOD;
       */
     protected function render_context_header(context_header $contextheader) {
 
+        $showheader = empty($this->page->layout_options['nocontextheader']);
+        if (!$showheader) {
+            return '';
+        }
+
         // All the html stuff goes here.
         $html = html_writer::start_div('page-context-header');
 
index 0c260d4..354af14 100644 (file)
@@ -82,7 +82,7 @@ $THEME->layouts = [
         'file' => 'columns2.php',
         'regions' => array('side-pre'),
         'defaultregion' => 'side-pre',
-        'options' => array('nonavbar' => true, 'langmenu' => true),
+        'options' => array('nonavbar' => true, 'langmenu' => true, 'nocontextheader' => true),
     ),
     // My public page.
     'mypublic' => array(
index 52b02fb..4a45d63 100644 (file)
@@ -2140,4 +2140,4 @@ div.editor_atto_toolbar button .icon {
     .dir-ltr-hide {
         display: none;
     }
-}
\ No newline at end of file
+}
index fc0b577..44a5067 100644 (file)
     along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 }}
 {{!
+    @template boost/header
+
+    This template renders the header.
+
+    Example context (json):
+    {
+        "contextheader": "context_header_html",
+        "settingsmenu": "settings_html",
+        "hasnavbar": false,
+        "navbar": "navbar_if_available",
+        "courseheader": "course_header_html"
+    }
+
     Page header.
 }}
 <header id="page-header" class="row">
     <div class="col-12 pt-3 pb-3">
-        <div class="card">
-            <div class="card-body">
+        <div class="card {{^contextheader}}border-0{{/contextheader}}">
+            <div class="card-body {{^contextheader}}p-2{{/contextheader}}">
                 <div class="d-flex">
+                    {{#contextheader}}
                     <div class="mr-auto">
-                    {{{contextheader}}}
+                        {{{contextheader}}}
                     </div>
+                    {{/contextheader}}
 
                     {{#settingsmenu}}
                     <div class="context-header-settings-menu">
index cb2acaa..d5ee09e 100644 (file)
@@ -88,7 +88,7 @@ $THEME->layouts = array(
         'file' => 'columns3.php',
         'regions' => array('side-pre', 'side-post'),
         'defaultregion' => 'side-pre',
-        'options' => array('langmenu' => true),
+        'options' => array('langmenu' => true, 'nocontextheader' => true),
     ),
     // My public page.
     'mypublic' => array(