TYPO3 为 IRRE tt_content 隐藏 colPos [英] TYPO3 hide colPos for IRRE tt_content

查看:21
本文介绍了TYPO3 为 IRRE tt_content 隐藏 colPos的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当添加自己的内容元素时,如 docs 然后实现所谓的 IRRE(内联类型)元素,这可以存储在未使用的 colPos 中,例如 99:

When adding own content elements as explained in the docs and then implementing so called IRRE (type inline) elements, this can be stored in an unused colPos, for example 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:

In the backend layout unfortunately the fake colPos needs to be present for some secret design reason:

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 子项将显示无效值 99".在列字段.也许这就是为什么有些人想要隐藏这个字段的原因,这似乎会产生所有其他问题..

Now, if this column is not present in the backendlayout we get terrible warnings that there are unused elements detected on the page. Also the IRRE child will show "invalid value 99" at the Column field. Maybe that's why some people want to hide this field, which produces all kinda of other problems it seems..

如果此列存在,它将与所有子元素一起显示在后端页面的底部.这会寻找包含大量自定义元素的大页面,当然超级凌乱并且容易被编辑器出错,并且完全不应该在设计上完全显示.

If this column is present, it will show at the bottom of the backend page with all the child elements. This looks for large pages with a lot of custom elements of course super messy and prone for making mistakes by editors, and should totally not be shown at all there by design.

在较旧版本的 TYPO3(10.4.x 之前)中,上述后端布局定义的 rowCount 为 1 将确保 colPos 99 不可见.

In older versions of TYPO3 (before 10.4.x) the above backend layout definition with a rowCount of 1 would ensure that colPos 99 is not visible.

似乎还有一些古老的记录不当的 tsconfig 设置,例如:

Also there seem to be some ancient badly documented tsconfig settings like:

mod.SHARED.colPos_list = 0
TCEFORM.tt_content.colPos.removeItems = 99
mod.web_layout.tt_content.colPos_list = 0

他们似乎根本没有做任何值得注意的事情.

They don't seem to do anything notable at all.

小姐Nicole Cordes 制作了一个扩展,它从‘未使用’列中使用自己的 colPos 配置删除使用过的内容元素"..非常高尚,但是在使用基本核心功能时,这种钩子不应该是这种方式.

Ms. Nicole Cordes made an extension which "Removes used content elements with own colPos configuration from 'Unused' colum". Very noble but imo this kinda of hooks should not be the way when using basic core functionality.

所以也许我遗漏了一些东西,或者有人可以告诉我如何以正确"的方式隐藏它?

So maybe I am missing something or could someone tell me how to hide this the 'proper' way?

顺便说一下,我现在通过加载额外的 后端的 CSS 然后:

By the way I now hide this unwanted colPos by loading extra CSS in the backend and then:

.t3-page-column-99 {
    display: none;
} 

推荐答案

使用 TSconfig,您可以限制后端用户可以编辑的列:
请参阅手册

With TSconfig you can restrict the columns a backend-user can edit:
see manual

// just edit columns 0,1 and 2, even when there are columns 3,4 and 5
mod.SHARED.colPos_list = 0,1,2

此外,您可以禁用所有受限列,因为 此更改

furthermore you can disable all restricted columns since this change

// hide all columns the user can't edit
mod.web_layout.hideRestrictedCols = 1

这个 TSConfig 应该可用于限制每个人的页面,或者用户/用户组只限制一些编辑器

this TSConfig should be available for pages restricting everyone, or for user/usergroups to restrict just some editors

这篇关于TYPO3 为 IRRE tt_content 隐藏 colPos的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆