content_defender icon indicating copy to clipboard operation
content_defender copied to clipboard

not providing a colPos results in configuration missmatch

Open DanielSiepmann opened this issue 5 years ago • 3 comments

It is possible to either define colPos = without a value, or to omit this value. In the 2nd case, the extension might not work as expected. Considering the following template:

 mod {
    web_layout {
        BackendLayouts {
            ContentWithCustomHeader {
                title = LLL:EXT:sitepackage/Resources/Private/Language/locallang.xlf:backendlayouts.contentWithCustomHeader
                config {
                    backend_layout {
                        colCount = 12
                        rowCount = 3
                        rows {
                            1 {
                                columns {
                                    1 {
                                        name = LLL:EXT:sitepackage/Resources/Private/Language/locallang.xlf:backendlayouts.columns.header.info
                                        colPos = 11
                                        colspan = 6
                                        allowed {
                                            CType = site_info
                                        }
                                    }
                                    2 {
                                        name = LLL:EXT:sitepackage/Resources/Private/Language/locallang.xlf:backendlayouts.columns.header.slider
                                        colspan = 6
                                    }
                                }
                            }
                            2 {
                                columns {
                                    1 {
                                        name = LLL:EXT:sitepackage/Resources/Private/Language/locallang.xlf:backendlayouts.columns.content
                                        colPos = 0
                                        colspan = 8
                                        disallowed {
                                            CType = site_info
                                        }
                                    }
                                    2 {
                                        name = LLL:EXT:sitepackage/Resources/Private/Language/locallang.xlf:backendlayouts.columns.navigation
                                        colspan = 4
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

Will not work as expected for colPos = 0 as row 1 column 2 already is evaluated as 0 and re used.

I would recommend to either document that a colPos should always be defined, or add a isset($column['colPos']) && check to BackendLayoutConfiguration::getConfigurationByColPos().

I guess the issue only occurs if colPos=0 comes after an missing colPos.

DanielSiepmann avatar Nov 27 '19 13:11 DanielSiepmann

Hi @DanielSiepmann,

Would you mind to point me to the documentation, that allows the abstinence of colPos completely? There are tests integrated for an empty value to hide the column from any input, but I'm not aware that completely omitting the colpos is possible too.

IchHabRecht avatar Nov 27 '19 13:11 IchHabRecht

Actually I encountered that using an empty colPos, instead of omitting it, results in the same title for columns within the same row :(

So to use TYPO3 without an assigned colPos (9.5 LTS), you actually need to not provide colPos at all.

Using above example with colPos = for row 2 and column 2 would result in the same title for row 2 and column 1, as both are considered "0" then by TYPO3.

Actually I am only aware of https://docs.typo3.org/m/typo3/reference-tsconfig/master/en-us/PageTsconfig/Mod.html#backendlayouts which is very basic and does not cover this case at all.

DanielSiepmann avatar Nov 27 '19 14:11 DanielSiepmann

https://github.com/TYPO3/TYPO3.CMS/blob/9.5/typo3/sysext/backend/Classes/View/PageLayoutView.php#L1190 is the place where TYPO3 has its logic. TYPO3 is also checking via isset first, then it will check for an empty string.

I would consider TYPO3 does support both ways, but has a bug in the one when colPos is empty.

DanielSiepmann avatar Nov 27 '19 14:11 DanielSiepmann

Hi @DanielSiepmann,

With the current version TYPO3 12.1 around, unused BackendLayout columns need to be configured as

2 {
    name = unused
}

This is tested with the provided fixtures for pageTS-Templates and I close this issue for now. If there are any further problems, please open a new issue.

IchHabRecht avatar Jan 05 '23 18:01 IchHabRecht