Adaptable

1. Config.php

Changes in /theme/adaptable/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’)


At line no 150

Code:

// The site home page.

    ‘frontpage’ => [

        ‘file’ => ‘frontpage.php’,

        ‘regions’ => array_merge($frontlayoutregions, [‘full-width-top’]),

        ‘defaultregion’ => ‘side-post’,

    ],

At line no 170

Code:

// My dashboard page.

    ‘mydashboard’ => [

        ‘file’ => ‘dashboard.php’,

        ‘regions’ => array_merge($frontlayoutregions, [‘content’, ‘full-width-top’]),

        ‘defaultregion’ => ‘side-post’,

        ‘options’ => [‘langmenu’ => true],

    ],

See the below image for reference

2. Changing the relevant php file

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

For frontpage frontpage.php

And for mydashboard dashboard.php is mention

1. Changes on fronpage.php

Changes in /theme/adaptable/layout/frontpage.php :-

Add following code at line no 32

before this line echo $OUTPUT->render_from_template….);

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;

    }

}

Also pass $templatecontext variable to renderer

echo $OUTPUT->frontpage_layout($templatecontext);

AD 4nXfgC3DyGSsjspRpbxyOIMFZtWD76Wku3jZXtdocR59mORefD CpxtbceK8OY96f0CxS2rXzGXO7t3CRSaqSmwjnot5BRzAi9TYjSTGyEI786lttLLyC

-> Now we had to use this $templatecontext on frontpage_layout to show on homepae

We had to update the code inside frontpage_layout function

Add following code at line no 1191

before this line

 [$secondarynavigation, $overflow] = $this->secondarynav();

Code:

public function frontpage_layout($templatecontext = null) {

        global $USER;

        $themesettings = \theme_adaptable\toolbox::get_settings();

        // Header.

        $sidepostdrawer = false;

        if (($themesettings->frontpageuserblocksenabled) || (is_siteadmin($USER))) {

            $sidepostdrawer = true;

        }

        $this->yesheader($sidepostdrawer);

        // Full width top

        if($templatecontext[‘canaddfwtopblocks’]) {

            echo ‘<section id=”region-fullwidthtop-blocks” class=”has-blocks” aria-label=”region top blocks”><div role=”region-main”>’;

            echo $templatecontext[‘sidefwtopblocks’];

            if($templatecontext[‘addblockbuttonfwtop’]) {

                echo ‘<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>’;

            }

            echo ‘</div></section>’;

        }

AD 4nXdXajFvtni2Ggpw6KYIruUREkG5LJw1EnvsL5rM0iSl1ypukMDgGYpNoE6L74h372oQbMT skrZwDtPlUW4CXRHu9 J ZUJF4Nbz6Fe8B0JZmDb5Gwb0EG1eqpuZQsVpwPrODdzsg?key=TPh6w bpl2ZimwvlNQvMLg

Addition of region on frontpage is Done

2. Changes for dashboard.php

Now make changes to show region on dashboard layout(dashboard & custom pages)

Same as frontpage

Changes in /theme/adaptable/layout/dashboard.php :-
Add following code at line no 31

before this line echo $OUTPUT->render_from_template….);

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;

    }

}

Also pass $templatecontext variable to renderer

echo $OUTPUT->dashboard_layout($templatecontext);

AD 4nXdnMPfqfuwjirp3LIM2yTwrQBdwX6QHHCvQi36W8xsK4csfQFfwFqaOPENhZoovHvfyq BTGil5RnknWOgyqyB0LhZe bX4dAsB

Changes in /theme/adaptable/classes/output/core_renderer_layout.php :-

Add following code at line no 972

before this line [$secondarynavigation, $overflow] = $this->secondarynav();

Code:

    public function dashboard_layout($templatecontext = null) {

        global $CFG, $USER;

        $themesettings = \theme_adaptable\toolbox::get_settings();

        // Include header.

        $this->yesheader(true);

        // Full width top region

        if($templatecontext[‘canaddfwtopblocks’]) {

            echo ‘<section id=”region-fullwidthtop-blocks” class=”has-blocks” aria-label=”region top blocks”><div role=”region-main”>’;

            echo $templatecontext[‘sidefwtopblocks’];

            if($templatecontext[‘addblockbuttonfwtop’]) {

                echo ‘<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>’;

            }

            echo ‘</div></section>’;

        }

Changes in /theme/adaptable/scss/main.scss :-

Add following scss code at the bottom

Code:

#page-epb-page-draft {

    #adaptable-page-header-wrapper {

    .page_sub_header {

        top: 0px;

    }

  }

}

AD 4nXequUgeg85Hdq5z53hxHjdw9WG5sqTtKqhsrpiNo TBhF6nLeqltG RIiIZBgQmh4pVtpFalhT8gVJJGdfq4VeQmDBC7Cy HfuBuov5AFcMUfw7N4pLDT9AKNk INF4BjF qUc2HQ?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?