0

I created in TYPO3 extension DCE an image field that allows to input an image with caption and title field in the backend. But I couldn't access the value of these fields to input in the alt-tag in source. No values are shown by f:debug, how can I access these values and output?

enter image description here

Nimantha
  • 6,405
  • 6
  • 28
  • 69
ayhan
  • 27
  • 7
  • Did you check the answer [here](https://stackoverflow.com/a/53950858/5961782)? – Geee Sep 15 '21 at 09:04
  • Let me describe it a little differently. I can view the decription with this variable: {field.imageDesktop.{i}.mergedProperties.description} But when I try to include it in the alt-tag i get this acception: Cannot access protected property TYPO3\CMS\Core\Resource\FileReference::$mergedProperties – ayhan Sep 15 '21 at 09:29

1 Answers1

1

The fastest solution would be having a look into the Class Reference of TYPO3\CMS\Core\Resource\FileReference. There are many getters for the properties. They access (and are allowed to access) the mergedProperties-array. In your special case getDescription() is, what you are looking for.

So for getting description a simple {field.imageDesktop.{i}.description} should work (if field.imageDesktop.{i} is a FileReference).

Julian Hofmann
  • 2,081
  • 1
  • 8
  • 16