Override image tag if it is the first?

109 Views Asked by At

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?

1

There are 1 best solutions below

2
Julian Hofmann On BEST ANSWER

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
}