0

I create a link to a file using filelink. I getting the name of the file using another Templavoila FCE field_title (see precedent post).

What I want is pretty simple, I want to display only the icon, not the label. I managed to display no text, but I still get the <a></a>.

I tried using labelStdWrap or labelStdWrap.override, but so far nothing worked. I found in the TsRef that you can hide the icon, but nothing is said about hiding the label.

Here is the Typoscript :

lib.field_datasheet = TEXT
lib.field_datasheet {
  value {
    field = field_title
    wrap = |.pdf
    }
  filelink {
    path = /fileadmin/datasheet/
    icon_link = 1
    }
 }

The HTML code I get is that :

<a href="/fileadmin/datasheet/Title.pdf">
 <img src="/typo3/sysext/frontend/Resources/Public/Icons/FileIcons/pdf.gif">
</a>
<a href="/fileadmin/datasheet/Title.pdf">Title.pdf</a>

And it's the entire last line I don't want to be displayed.

CCR
  • 154
  • 4
  • 18

2 Answers2

1

You can remove the label with link in this way:

lib.field_datasheet = TEXT
lib.field_datasheet {
  value {
    field = field_title
    wrap = |.pdf
  }
  filelink {
    path = /fileadmin/datasheet/
    icon = 1
    icon_link = 1
    file.cObject = TEXT
  }
}

file.cObject = TEXT will remove the label and link, but the icon and its link will be unaffected.

Rudy Gnodde
  • 4,286
  • 2
  • 12
  • 34
  • Thank you for your answer. I've just edited my question (but too late) to be more precise. It works but a is still generated, and to be clean, I'd like that not to be. – CCR Jul 12 '18 at 12:22
  • I've edited my answer to answer your edited question now :) – Rudy Gnodde Jul 12 '18 at 12:45
0

you have two options to clear an earlier set property:

This will remove the property (and subproperties) from the typoscript definition:
lableStdWrap >

this obviously also removes all further stdWrap functions

and this will set an empty string:
labelStdWrap =

be aware: this might result in no wrapping, so you loose more than just the text.

You can use these in combination with typoscript conditions, but not with condition wraps (.if..., .override, .ifEmpty, ...)

Bernd Wilke πφ
  • 10,390
  • 1
  • 19
  • 38
  • Thank you for your answer. As I just added in the question, I also want to not have the around the label. It's that part which is more difficult. I've tried what you said without success, but maybe I did it wrong, it didn't delete the tag. – CCR Jul 12 '18 at 12:48