patlabs/sulu-configuration-bundle
最新稳定版本:0.2.0
Composer 安装命令:
composer require patlabs/sulu-configuration-bundle
包简介
A Sulu bundle for managing dynamic configuration settings through the admin interface with form-based configuration storage and retrieval
README 文档
README
SuluConfigurationBundle enables easy creation, management and use of custom configurations in Sulu CMS. It provides a flexible structure for defining and maintaining settings via the admin interface or programmatically via Symfony.
📦 Requirements
- Sulu CMS >= 2.6
🚀 Features
- Configuration management via the Sulu admin UI
- Support for all Sulu form fields
- Ability to group and structure settings
- Integration in Twig and controllers via simple service access
🛠️ Installation
composer require patlabs/sulu-configuration-bundle
Then register the bundle:
// config/bundles.php return [ // ... PatLabs\SuluConfigurationBundle\SuluConfigurationBundle::class => ['all' => true], ];
Add the admin routing configuration:
# config/routes/sulu_admin.yaml ... sulu_config_api: resource: "@SuluConfigurationBundle/Resources/config/routing_api.yml" type: rest prefix: /admin/api
Add the following package configuration:
# config/packages/sulu_configuration.yaml sulu_configuration: configurations: directories: - '%kernel.project_dir%/config/configs'
Create the configs folder: config/configs
In this folder, all desired configurations can be defined. To do this, simply create an XML that defines an Admin Form, as you already know. (https://docs.sulu.io/en/2.6/book/extend-admin.html#form-configuration)
Last but not least, you need to update the database schema:
php bin/console doctrine:schema:update --force
🛠️ Configuration
To add a custom settings panel in the administration, simply create an XML in config/configs that defines an Admin Form, as you already know. (https://docs.sulu.io/en/2.6/book/extend-admin.html#form-configuration)
Also have a look at the example. (https://github.com/patrickpahlke03/SuluConfigurationBundle/tree/main/Resources/example)
🔤️ Admin UI
The bundle integrates seamlessly into the Sulu Admin Interface and allows:
- Editing of all defined configurations
- Validation of inputs
💡 Usage in Code
// Controller $siteTitle = $this->get(\PatLabs\SuluConfigurationBundle\Services\ConfigService::class)->getConfig('configKey.fieldName');
Or in Twig:
{{ sulu_config('configKey.fieldName') }}
Made with ❤️ for Sulu Developers
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-30