定制 riddlestone/brokkr-portals 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

riddlestone/brokkr-portals

Composer 安装命令:

composer require riddlestone/brokkr-portals

包简介

A Laminas module to pull configuration together for portals, such as a public portal, an admin portal, etc.

README 文档

README

A Laminas module to pull configuration together for portals, such as a public portal, an admin portal, etc.

Adding Configuration

To add information about a portal, add it to a module configuration file under portals.{portal_name}:

return [
    'portals' => [
        'main' => [
            'layout' => 'main.layout',
            'css' => [
                __DIR__ . '/../css/styles.css',
            ],
            'js' => [
                __DIR__ . '/../js/scripts.js',
            ],
        ],
    ],
];

Portals also supports lazy configuration loading through PortalConfigProviders:

return [
    'portal_manager' => [
        'provider_names' => [
            'My\\Portal\\Config\\Provider',
        ],
        'factories' => [
            'My\\Portal\\Config\\Provider' => 'My\\Portal\\Config\\ProviderFactory',
        ],
    ],
];

Portal Features

Features allow you to group portal configuration together, and assign it to a portal separately. This might be usefuuul if some modular functionality requires multiple css/js files, but the module doesn't know which portals it will be used in:

return [
    'portals' => [
        'main' => [
            'features' => [
                'some-functionality',
            ],
        ],
    ],
    'portal_features' => [
        'some-functionality' => [
            'css' => [
                __DIR__ . '/../css/styles.css',
            ],
            'js' => [
                __DIR__ . '/../js/scripts.js',
            ],
        ],
    ],
];

Here the module can define the js and css required for portal_features/some-functionality, and the project can declare that portals/main uses it.

Getting the Portal Manager

/** @var \Laminas\ServiceManager\ServiceManager $serviceManager */

$portalManager = $serviceManager->get(\Riddlestone\Brokkr\Portals\PortalManager::class);

Getting Configuration

/** @var \Riddlestone\Brokkr\Portals\PortalManager $portalManager */

# get a list of portals
$portals = $portalManager->getPortalNames();

# set the current portal
$portalManager->setCurrentPortalName('main');

# get the current portal name
$portalName = $portalManager->getCurrentPortalName();

# check a portal has config
$hasConfig = $portalManager->hasPortalConfig('main', 'css');

# check the current portal has config
$hasConfig = $portalManager->hasCurrentPortalConfig('css');

# get the config for a portal
$portalConfig = $portalManager->getPortalConfig('main', 'css');

# get the config for the current portal
$portalConfig = $portalManager->getCurrentPortalConfig('css');

统计信息

  • 总下载量: 70
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2020-02-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固