kaliop / kaliop-ez-remoteid-bundle
此软件包提供了参考标签,用户可以在管理面板的位置视图中更改远程ID(需有相应权限)。
0.2.5
2019-11-14 10:14 UTC
Requires
- php: ^7.1
- ezsystems/ezpublish-kernel: >=7.2
- twig/twig: ^2.0
README
软件包在管理面板的位置视图中添加了参考标签,用户可以在此处更改远程ID(需有相应权限)。
安装
composer require kaliop/kaliop-ez-remoteid-bundle
-
在内核中启用软件包
public function registerBundles() { // ... $bundles = [ // ... new Kaliop\EzRemoteIdBundle\KaliopEzRemoteIdBundle() ]; // ... }
-
将KaliopEzRemoteIdBundle添加到assetic配置。
assetic: bundles: # ... - KaliopEzRemoteIdBundle
-
在app/config/routing.yml中导入路由
kaliop_remote_id: resource: "@KaliopEzRemoteIdBundle/Resources/config/routing.xml" prefix: /
-
配置
kaliop_ez_remote_id:
content_types:
test:
pattern: '/^[a-z][a-z0-9]*$/'
max_length: 32
test2:
max_length: 8
pattern: '/^[a-z][a-z0-9]*$/'
test3:
pattern: '/^.*$/'
max_length: 32
test4:
pattern: '/^a.*b$/'
max_length: 10
default:
pattern: '/^[a-z][a-z0-9]*$/'
max_length: 32
默认值是在未提供这些值时设置的。例如,此配置也可以通过以下方式实现:
kaliop_ez_remote_id:
content_types:
test: ~
test2:
max_length: 8
test3:
pattern: /^.*$/
test4:
pattern: /^a.*b$/
max_length: 10
注意:请记住,max_length
不应超过数据库表中的约束(100个字符,即VARCHAR(100)
)。这可能会因ezPlatform的不同版本而有所不同,因此在您的当前实现中检查它是一个好习惯。
注意:无效模式消息有两种形式。如果模式描述定义在翻译域kaliop_ez_remote_id
中,如下所示
# kaliop_ez_remote_id.en.yml
pattern_description:
'/^[a-z0-9]+$/': Value must contain only small letters and numbers.
那么验证消息将从键kaliop_ez_remote_id.validator.remote_id_pattern.invalid
构建,并且描述在参数%patternDescription%
中可用。如果没有为模式提供翻译,则使用kaliop_ez_remote_id.validator.remote_id_pattern.invalid_default
,并且模式在参数%pattern%
中可用。
kaliop_ez_remote_id:
remote_id_pattern:
invalid: Remote ID has invalid format. %patternDescription%
invalid_default: Remote ID has invalid format. Value must match %pattern%.
-
清除缓存
php bin/console cache:clear
-
安装资产
php bin/console assets:install --symlink --relative
-
通过添加正确的策略来配置权限。查看策略用于显示位置视图中的参考标签。允许编辑的用户更改远程ID。