如何覆盖 OctoberCMS 后端布局?

How to override OctoberCMS backend layouts?

是否可以覆盖后端布局?例如后台主菜单(/modules/backend/layouts/_mainmenu.htm)

当然,在问完问题后我就找到了解决方案。原来如此。

默认情况下,您只能更改用于后端的皮肤。因此,要扩展它,您首先需要创建一个新的 class 来扩展默认后端皮肤信息文件 (/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'
        ];
    }
}

现在您只需将现有布局复制到该文件夹​​并根据需要进行修改。