eugenec137/cakephp-utils

CakePHP 工具

安装次数: 8

依赖项: 1

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 0

开放问题: 0

语言:JavaScript

类型:CakePHP 插件

v1.0.0 2023-07-04 09:44 UTC

This package is not auto-updated.

Last update: 2024-09-24 15:20:00 UTC


README

codecov Build Status Latest Stable Version Total Downloads Latest Unstable Version License

提供多种通用且对多个插件和应用程序有用的工具。

Qobo 开发,并在Qobrix中使用。

使用方法

使用composer安装插件

composer require qobo/cakephp-utils

加载插件

bin/cake plugin load Qobo/Utils --bootstrap

检查插件是否已加载

bin/cake plugin loaded

上述操作应输出加载的插件列表,其中应包含Qobo/Utils

功能

AdminLTE

本插件的主要目标之一是简化AdminLTE主题CakePHP插件的加载和配置。以下是需要设置的内容。

加载AdminLTE插件

bin/cake plugin load AdminLTE --routes --bootstrap

config/bootstrap.php的底部加载AdminLTE插件配置

Configure::load('admin_lte', 'default');

以下是一个您可以将其粘贴到config/admin_lte.php中的示例配置

<?php
return [
    'Theme' => [
        'folder' => ROOT,
        'title' => 'My App',
        'logo' => [
            // This will be displayed when main menu is collapsed.
            // You can use an <img> tag in here or anything else you want.
            'mini' => 'A',
            // This will be displayed when main menu is expanded.
            // You can use an <img> tag in here or anything else you want.
            'large' => 'My App',
        ],
        'login' => [
            'show_remember' => true,
            'show_register' => false,
            'show_social' => false,
        ],
    ],
];

src/Controller/AppController.phpbeforeRender()方法中加载AdminLTE主题

// At the top of the file, together with other use statements:
use Cake\Core\Configure;

public function beforeRender(Event $event)
{
    $this->viewBuilder()->theme('AdminLTE');
    $this->set('theme', Configure::read('Theme'));
    // $this->set('user', $this->Auth->user());
    $this->set('user', []);
}

src/View/AppView.phpinitialize()方法中加载AdminLTE表单助手

public function initialize()
{
    $this->loadHelper('Form', ['className' => 'AdminLTE.Form']);
}

有关初始化和配置AdminLTE主题的更多信息,请参阅插件文档