CCR
CCR

Reputation: 154

Typoscript filelink - Hide label

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.

Upvotes: 0

Views: 117

Answers (2)

Rudy Gnodde
Rudy Gnodde

Reputation: 4565

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.

Upvotes: 1

Bernd Wilke πφ
Bernd Wilke πφ

Reputation: 10790

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, ...)

Upvotes: 0

Related Questions