How to override OctoberCMS backend layouts?

- 1 answer

Ad

Is it possible to override backend layouts? For example the backend main menu (/modules/backend/layouts/_mainmenu.htm)

Ad

Answer

Ad

And of course the solution comes to me after asking the qustion. So here it is.

By default you can only change the skin that is used for the backend. So to extend it you first need to create a new class that extends the default backend skin information file (/modules/backend/skins/Standard.php)

<?php namespace Author\Plugin\Classes;

use Backend\Skins\Standard;

/**
 * Modified backend skin information file.
 *
 * This is modified to include an additional path to override the default layouts.
 *
 */

class BackendSkin extends Standard
{
    /**
     * {@inheritDoc}
     */
    public function getLayoutPaths()
    {
        return [
            base_path() . '/plugins/author/plugin/skin/layouts',
            $this->skinPath . '/layouts'
        ];
    }
}

And now you can just copy the existing layouts to that folder and modify them as you please.

Ad
source: stackoverflow.com
Ad