user500665
user500665

Reputation: 1364

Override image tag if it is the first?

I am using TYPO3 7.6 with 'CSS Styled Content'.

What I want to do is override the img tag if it is the first image listed in the content element.

So I have added a custom img tag under tt_content.image.20.1.1.layout.custom

Now how do I override tt_content.image.20.1.1.layoutKey if it is the first image?

Eg:

tt_content.image.20.1.1.layoutKey.override = custom
tt_content.image.20.1.1.layoutKey.override.if {
    value = 1
    equals.field = imageOrderNumber??
}

Or is there another way?

Upvotes: 1

Views: 120

Answers (1)

Julian Hofmann
Julian Hofmann

Reputation: 2592

There is a register containing the current image number: register:IMAGE_NUM_CURRENT.

So it should work like this:

tt_content.image.20.1.1.layoutKey.override = custom
tt_content.image.20.1.1.layoutKey.override.if {
    value = 1
    equals.data = register:IMAGE_NUM_CURRENT
}

Upvotes: 3

Related Questions