Typoscript Condition: backend_layout (with slide)

走远了吗. 提交于 2019-12-02 06:54:38

问题


I use this condition

[globalVar = GP:colPos==0]&&[page|backend_layout = pagets__MainTemplate]

My problem is that my „subpage“ has no backend_layout selected because the parent pages "Backend Layout (subpages of this page)“ is set. So the condition does not work on subpages.

Can create a condition like that?

lib.backendLayout = TEXT
lib.backendLayout {
    data = levelfield:-1, backend_layout_next_level, slide
    override.data = TSFE:page|backend_layout
}

I want do white/blacklist CTypes in BE Columns in this way:

[globalVar = GP:colPos==0]&&[page|backend_layout = pagets__MainTemplate]
    TCEFORM.tt_content.CType.keepItems := addToList(header)
[end]

回答1:


Not as far as I know, as you can only access the current page record with the "page" condition.

Instead you could

a) Write your own condition (see https://docs.typo3.org/typo3cms/TyposcriptReference/8.7/Conditions/Reference/Index.html#custom-conditions or starting with version 9 https://docs.typo3.org/typo3cms/TyposcriptReference/Conditions/Reference.html#extending-the-expression-language-with-own-functions-like-old-userfunc)

b) Use a userFunc (like "a" only older and less fancy ;)) - see https://docs.typo3.org/typo3cms/TyposcriptReference/8.7/Conditions/Reference/Index.html#userfunc

new c) follow Jigals suggestion (or use a similar extension - there are a few - but they mostly do a lot more than what you need)

--- EDIT after question update ---

As you want it working in TSConfig c) is actually not an option.

c) depending on what you actually want to achieve with your condition use if and data (like in your description) directly at the TS objects that should have different behavior if your condition is true.

For reference:

Differences between TSConfig Conditions and TS Conditions: https://docs.typo3.org/typo3cms/TSconfigReference/8.7/Conditions/Index.html#differences-to-conditions-in-typoscript-templates




回答2:


As an alternative to Susi's solutions you could use Gridelements. This extension has the feature that you can set inside each block in a backend layout which CEs are allowed.



来源:https://stackoverflow.com/questions/39614470/typoscript-condition-backend-layout-with-slide

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!