Boost

1. Config.php

Changes in  /theme/boost/config.php :-

Update $THEME->layout 

In layouts array there are lots of layout available we will update two layouts frontpage and mydashboard

We will update the regions array and add new layout names with existing ones (‘full-width-top’, and ‘full-bottom’) 

Code:
        // The site home page.

    ‘frontpage’ => array(

        ‘file’ => ‘drawers.php’,

        ‘regions’ => array(‘side-pre’, ‘full-width-top’, ‘full-bottom’),

        ‘defaultregion’ => ‘side-pre’,

        ‘options’ => array(‘nonavbar’ => true),

    ),

Code:

         // My dashboard page.

    ‘mydashboard’ => array(

        ‘file’ => ‘drawers.php’,

        ‘regions’ => array(‘side-pre’, ‘full-width-top’, ‘full-bottom’),

        ‘defaultregion’ => ‘side-pre’,

        ‘options’ => array(‘nonavbar’ => true, ‘langmenu’ => true),

    ),

AD 4nXfB7IptoeTojaoGKsyO4cwhUI8QhJdg6UwNbr3uSyaz atua8c9f1gquOmkR3PqztKObfRt2SzsrcCQSmEmO8HqGpIEl35AXuoPGMbXRQmh T HgIoEh5LWBvBzGnF7i AVcI1XAQ?key=TPh6w bpl2ZimwvlNQvMLg

2. Changing the relevant php file

Php file name is mentioned on config layout with file field (see the $THEME->layout layouts)

For frontpage and mydashboard   drawers.php

-> this file is located on layout folder of theme

Changes in /theme/boost/layout/drawers.php :-
Add following code before the line 

echo $OUTPUT->render_from_template(‘theme_boost/drawers’, $templatecontext);

Code:
            // Top region full width.

if (in_array(“full-width-top”, $this->page->blocks->get_regions())) {

    $addblockbuttonfwtop = $OUTPUT->addblockbutton(‘full-width-top’);

    $sidefwtopblocks = $OUTPUT->blocks(‘full-width-top’);

    // Strlen Calculation is total jugad.

    if (trim($addblockbuttonfwtop) != ” || (trim($sidefwtopblocks) != ” && strlen($sidefwtopblocks) > 117)) {

        $templatecontext[‘addblockbuttonfwtop’] = $addblockbuttonfwtop;

        $templatecontext[‘sidefwtopblocks’] = $sidefwtopblocks;

        $templatecontext[‘canaddfwtopblocks’] = true;

    }

}

// bottom region full width.

if (in_array(“full-bottom”, $this->page->blocks->get_regions())) {

    $addblockbuttonfwbottom = $OUTPUT->addblockbutton(‘full-bottom’);

    $sidefwbottomblocks = $OUTPUT->blocks(‘full-bottom’);

    // Strlen Calculation is total jugad.

    if (trim($addblockbuttonfwbottom) != ” || (trim($sidefwbottomblocks) != ” && strlen($sidefwbottomblocks) > 117)) {

        $templatecontext[‘addblockbuttonfullwidthbottom’] = $addblockbuttonfwbottom;

        $templatecontext[‘sidefullwidthbottomblocks’] = $sidefwbottomblocks;

        $templatecontext[‘canaddfullwidthbottomblocks’] = true;

    }

}

3. Now we can add regions anywhere on frontpage, and dashboard by mustache file 

For dashboard and frontpage

You can add regions anywhere on the Frontpage or Dashboard via the related Mustache file.

The Mustache file path is mentioned in the last line of the related PHP file.

Example:

In the drawers.php file, you will see this line at the end of the PHP file:

echo $OUTPUT->render_from_template(‘theme_boost/drawers, $templatecontext);

This means the Mustache path is:
/drawers

It is located at:
theme/boostn/templates/drawers.mustache

Note:

We had to add two regions 1st on top and 2nd on bottom

Changes in /theme/boost/templates/drawers.mustache :-

add following code after the line <div id=“page” data-region=“mainpage”….

Code:

{{#canaddfwtopblocks}}

     <section id=”region-fullwidthtop-blocks” class=”has-blocks” aria-label=”region top blocks”>

        <div role=”region-main”>

           {{{ sidefwtopblocks }}}

           {{#addblockbuttonfwtop}}

            <div id=”region-fullwidthtop-blocks-indicator” class=”container-fluid block-indicator”>

               <font class=”text-center p-px-2d5 m-0  bg-white block-indicator-text-wrapper “>

                  Full-width Top

                </font>

            </div>

        {{/addblockbuttonfwtop}}

       </div>

     </section>

  {{/canaddfwtopblocks}}

AD 4nXeaKDjH4P6bu48aWnlS Ww4RfEeorwvk2rpOdS k0LD0W9L2tCmjEGscmnsMv6bspdTRzEb9nHCBBgjed1nRuZzusz nJKn1ITJTBidM 2khD8iIzWkiLuf88YdYDgkU8Vfccm?key=TPh6w bpl2ZimwvlNQvMLg

At line no 352 add following code before the line {{> theme_boost/footer }}

Code:

{{#canaddfullwidthbottomblocks}}

  <section id=”region-fullwidthbottom-blocks” class=”has-blocks” aria-label=”region top blocks”>

       <div role=”region-main”>

             {{{ sidefullwidthbottomblocks }}}

             {{#addblockbuttonfullwidthbottom}}

             <div id=”region-fullwidthbottom-blocks-indicator” class=”container-fluid block-indicator”>

                  <font class=”text-center p-px-2d5 m-0  bg-white block-indicator-text-wrapper “>

                  Full-width Bottom

                  </font>

             </div>

             {{/addblockbuttonfullwidthbottom}}

         </div>

   </section>

{{/canaddfullwidthbottomblocks}}

AD 4nXdIyw3nrfCDXAIQD7tJ6Dg9 rVNA7V53dgdaFVq51J3RRiY3DF9KLB09xyXBdQ5xTHV6j19I1uHQ e1I1UYuO8KI0LyUCv8HOcfV4sYiaQ5RXFBh4hFfox 1nmRXVNUfbSKB 1aVA?key=TPh6w bpl2ZimwvlNQvMLg

Now Enable the edit mode and go to the homepage, dashboard, or any custom page; you will now be able to add page builder blocks as well as Moodle blocks.

Was this page helpful?