【发布时间】:2018-02-15 16:02:04
【问题描述】:
我通过扩展生成器为 FE 用户注册创建了一个新扩展。 TYPO3 版本 8.7.7
我在设置下定义了两个常量(在 extbase 和流体中获取这些常量):
- storagePid
- 成员组
constants.ts 有如下代码:
## Custom Sub-Categories
# customsubcategory=01_Storage=LLL:EXT:rmregistration/Resources/Private/Language/locallang_db.xlf:extension_configuration.customSubCategories.storage
# customsubcategory=02_Groups=LLL:EXT:rmregistration/Resources/Private/Language/locallang_db.xlf:extension_configuration.customSubCategories.groups
plugin.tx_rmregistration {
view {
# cat=plugin.tx_rmregistration/file; type=string; label=Path to template root (FE)
templateRootPath = EXT:rmregistration/Resources/Private/Templates/
# cat=plugin.tx_rmregistration/file; type=string; label=Path to template partials (FE)
partialRootPath = EXT:rmregistration/Resources/Private/Partials/
# cat=plugin.tx_rmregistration/file; type=string; label=Path to template layouts (FE)
layoutRootPath = EXT:rmregistration/Resources/Private/Layouts/
}
persistence {
# cat=plugin.tx_rmregistration//a; type=string; label=Default storage PID
storagePid =
}
settings {
# cat=plugin.tx_rmregistration/01_Storage/001; type=int[0-999]; label=LLL:EXT:rmregistration/Resources/Private/Language/locallang_db.xlf:extension_configuration.storagePid_and_description
storagePid =
# cat=plugin.tx_rmregistration/02_Groups/011; type=int[1-999]; label=LLL:EXT:rmregistration/Resources/Private/Language/locallang_db.xlf:extension_configuration.groupId_and_description
memberGroup =
}
}
setup.ts 有以下代码:
plugin.tx_rmregistration {
view {
templateRootPaths.0 = EXT:rmregistration/Resources/Private/Templates/
templateRootPaths.1 = {$plugin.tx_rmregistration.view.templateRootPath}
partialRootPaths.0 = EXT:rmregistration/Resources/Private/Partials/
partialRootPaths.1 = {$plugin.tx_rmregistration.view.partialRootPath}
layoutRootPaths.0 = EXT:rmregistration/Resources/Private/Layouts/
layoutRootPaths.1 = {$plugin.tx_rmregistration.view.layoutRootPath}
}
persistence {
storagePid = {$plugin.tx_rmregistration.persistence.storagePid}
#recursive = 1
}
features {
#skipDefaultArguments = 1
# if set to 1, the enable fields are ignored in BE context
ignoreAllEnableFieldsInBe = 0
# Should be on by default, but can be disabled if all action in the plugin are uncached
requireCHashArgumentForActionArguments = 1
}
mvc {
#callDefaultActionIfActionCantBeResolved = 1
}
settings {
storagePid = {$plugin.tx_rmregistration.settings.storagePid}
memberGroup = {$plugin.tx_rmregistration.settings.memberGroup}
}
}
现在,如果我转到 Template-Module -> Constant-Editor -> PLUGIN.TX_RMREGISTRATION 我会找到我的两个自定义常量,正如预期的那样。
但是如果我想更改一个值,我会遇到以下问题:
问题
初始情况:
- 我有一个活动字段,里面有一个值。
- 我的另一个字段里面没有值(灰色)。
现在如果我点击edit-undo-按钮(在memberGroups)并保存它,memberGroups 将被停用(灰色),但另一个字段现在被激活。?!
我怎样才能防止这种“切换节省”???
我试图自己解决的问题
- 清除整个缓存(fe-cache 和 system-cache)
- 通过安装工具清除整个缓存
- 清除浏览器缓存
我想知道什么
- 请教知名大师 google :D
- 搜索stackoverflow系统
- 问我的程序员大师(他说这可能是错误粘贴问题,但我不知道我会在哪里粘贴错误内容。
编辑
我更改了我的 sys_templates.php 和 tt_content.php(如您在 cmets 中看到的)并更改了 constants.txt(我删除了以下代码中的视图部分和 customsubcategories(它是和上面一样)。
constants.ts
plugin.tx_rmregistration {
persistence {
# cat=plugin.tx_rmregistration/01_Storage/a; type=string; label=LLL:EXT:rmregistration/Resources/Private/Language/locallang_db.xlf:extension_configuration.storagePid_and_description
storagePid = 0
}
settings {
# cat=plugin.tx_rmregistration/01_Storage/a; type=int[1-999]; label=LLL:EXT:rmregistration/Resources/Private/Language/locallang_db.xlf:extension_configuration.storagePid_and_description
storagePid = 0
# cat=plugin.tx_rmregistration/02_Groups/a; type=int[2-999]; label=LLL:EXT:rmregistration/Resources/Private/Language/locallang_db.xlf:extension_configuration.groupId_and_description
memberGroup = 1
}
}
更改:默认值和可能输入的范围。
编辑:删除坏词设置(对问题不重要)
同样的问题
编辑 2
似乎是这样,失败效果(切换)只出现在type=int[range] 常量中。
我做了一些测试。
首先我更改了常量:S & STR 常量为type=string,M & T 常量为type=int[range] 常量以进行调试。
传说:
- [ ] 灰显
- 有值的数字
测试 1:
- 之前:S [ ] M 2 T 3 STR [ ]
- 设置:S 1(更改字符串常量)
- 之后:S 1 M 2 T 3 STR [ ]
- 作品:是的
测试 2:
- 之前:S 1 M 2 T 3 STR [ ]
- 设置:STR 3(更改字符串常量)
- 之后:S 1 M 2 T 3 STR 3
- 作品:是的
测试 3:
- 之前:S 1 M 2 T 3 STR 3
- 设置:M [ ](更改 int[range] 常量)
- 之后:S 1 M [ ] T 3 STR 3
- 作品:第一个 int[range]-change yes
测试 4:
- 之前:S 1 M [ ] T 3 STR 3
- 设置:T [ ](尝试更改一个 int[range] 常量)
- 之后:S 1 M 2 T 3 STR 3
- 有效:这里又是切换错误(标记)M 应该是 [ ]
【问题讨论】:
-
要明确您的问题:您的意思是您的默认存储 Pid 字段不再被停用,但您还没有更改它?如果是这样,您能否查看 sys_template 中的常量部分并判断是否有
plugin.tx_mmregistration.settings.storagePid行? -
是的,如果我停用 memberGroup,storagePid 会自动激活。在 sys_template 中没有
plugin.tx_rmregistration.settings.storagePid。我没有 sys_templates.php 也没有 tt_content.php(因为扩展生成器只创建ext_tables.php)。我现在将其迁移到tt_content.php和sys_templates.php,但该问题没有任何改变。 -
用一些调试信息更新我的问题。
标签: typo3 constants typoscript