bschauer
bschauer

Reputation: 1008

Typoscript Condition: backend_layout (with slide)

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]

Upvotes: 1

Views: 1336

Answers (2)

Susi
Susi

Reputation: 718

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

Upvotes: 2

Jigal van Hemert
Jigal van Hemert

Reputation: 722

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.

Upvotes: 0

Related Questions