Reputation: 618
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'
]
],
]
],
],
]
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 =
}
}
}
}
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.
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. [EDIT] When GridElements installed this still works.
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.
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?
By the way I now hide this unwanted colPos by loading extra CSS in the backend and then:
.t3-page-column-99 {
display: none;
}
Upvotes: 1
Views: 1586
Reputation: 1
This seems to work only in Page TSconfig and not anymore in User TSconfig:
mod.SHARED.colPos_list
You can handle this by a condition in Page TSconfig:
[backend.user.userId == 3]
mod.SHARED.colPos_list = 0,1,2
[end]
Working in T3 V. 10.4.20 to hide cols 0,1,2 for user with ID=3.
Upvotes: 0
Reputation: 10790
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
this TSConfig should be available for pages restricting everyone, or for user/usergroups to restrict just some editors
Upvotes: 0
Reputation: 1956
The PagelayoutHook is actually the go way to go. There is currently no other way. If you want to implement it yourself, it is pretty easy.
I explained everything here.
TYPO3 is migrating towards PSR standards, so Hooks are being replaced. Slowly but they will eventually go away. Instead Events/Listens will take their place. When the times comes, everyone will be happy :)
Don’t get hooked, listen to events! PSR-14
Best regards
Upvotes: 0