bitscout/simple-config

在 SonataAdmin 中配置几个全局变量的简单方法

安装: 13

依赖项: 0

建议者: 0

安全: 0

星星: 1

观察者: 2

分支: 0

公开问题: 1

类型:symfony-bundle

dev-main 2020-11-15 22:37 UTC

This package is auto-updated.

Last update: 2024-09-16 07:42:24 UTC


README

在 SonataAdmin 中配置几个全局变量的简单方法。使用 YAML 定义它们,允许用户在管理界面中编辑它们。

状态:进行中,尚未实现

安装

只需运行 composer require bitscout/simple-config,然后向您的 bundles.php 文件中添加以下行:

Bitscout\SimpleConfig\BitscoutSimpleConfigBundle::class => ['all' => true],

配置

创建文件 config/packages/bitscout_simple_config.yaml

bitscout_simple_config:
  fields:
    foo:
      label: Fubar
      type: int
      default: bar
      show: true   # optional, default true

这将立即为您提供一个环境变量 SIMPLE_CONFIG_FOO,其值为 "bar"

在您的 sonata_admin.yaml 文件中,向路由 admin_app_bitscout_simple_config_list 添加一个菜单条目。

管理

待办事项

添加 Sonata 管理员(列表/编辑)以在数据库中设置值,然后将其加载以替换默认值。