【发布时间】:2021-08-07 10:45:44
【问题描述】:
当按照docs 中的说明添加自己的内容元素,然后实现所谓的 IRRE(内联类型)元素时,可以将其存储在未使用的 colPos 中,例如 99:
$newTCAcolumns[] = [
'xxx_cta_blocks' => [
'exclude' => 1,
'label' => 'Content',
'config' => [
'type' => 'inline',
'allowed' => 'tt_content',
'foreign_table' => 'tt_content',
'foreign_sortby' => 'sorting',
'foreign_field' => 'xxx_foreign',
'minitems' => 1,
'maxitems' => 3,
'appearance' => [
'collapseAll' => true,
'expandSingle' => true,
'levelLinksPosition' => 'bottom',
'useSortable' => true,
'showPossibleLocalizationRecords' => true,
'showRemovedLocalizationRecords' => true,
'showAllLocalizationLink' => true,
'showSynchronizationLink' => true,
'enabledControls' => [
'info' => false,
]
],
'behaviour' => [
'allowLanguageSynchronization' => true,
],
'overrideChildTca' => [
'columns' => [
'colPos' => [
'config' => [
'default' => 99
]
],
'CType' => [
'config' => [
'default' => 'xxx_cta_block'
]
],
]
],
],
]
不幸的是,由于一些秘密的设计原因,在后端布局中需要存在假 colPos:
mod {
web_layout {
BackendLayouts {
default {
title = Default
config {
backend_layout {
colCount = 1
rowCount = 1
rows {
1 {
columns {
1 {
name = Content
colPos = 0
}
}
}
99 {
columns {
1 {
name = Within content element
colPos = 99
}
}
}
}
}
}
icon =
}
}
}
}
现在,如果后端布局中不存在此列,我们会收到可怕的警告,即在页面上检测到未使用的元素。此外,IRRE 子项将在 Column 字段中显示“无效值 99”。也许这就是为什么有些人想隐藏这个字段,它似乎产生了各种other problems..
如果此列存在,它将显示在后端页面的底部以及所有子元素。这会寻找包含大量自定义元素的大页面,当然超级混乱并且容易被编辑者犯错误,并且完全不应该在设计上显示出来。
在旧版本的 TYPO3(10.4.x 之前)中,上面的 rowCount 为 1 的后端布局定义将确保 colPos 99 不可见。 [编辑] 安装 GridElements 后,它仍然有效。
似乎还有一些古老的记录不良的 tsconfig 设置,例如:
mod.SHARED.colPos_list = 0
TCEFORM.tt_content.colPos.removeItems = 99
mod.web_layout.tt_content.colPos_list = 0
他们似乎根本没有做任何值得注意的事情。
女士。 Nicole Cordes 制作了一个extension,其中“从‘未使用’列中删除了具有自己 colPos 配置的已使用内容元素”。非常高尚,但在使用基本核心功能时,这种钩子不应该是这种方式。
所以也许我遗漏了什么,或者有人可以告诉我如何以“正确”的方式隐藏它吗?
顺便说一句,我现在通过加载额外的 CSS in the backend 来隐藏这个不需要的 colPos,然后:
.t3-page-column-99 {
display: none;
}
【问题讨论】:
标签: typo3 tsconfig typo3-10.x