Last active
November 5, 2020 13:46
-
-
Save Megafry/518d9015a67717279b8dc2f0cab41efd to your computer and use it in GitHub Desktop.
TypoScript to extend TYPO3 parseFunc, adding the file-extention and size to all link
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lib.parseFunc { | |
tags.a.typolink { | |
#add text in the A-Tag | |
ATagBeforeWrap = 1 | |
wrap.cObject = FILES | |
wrap.cObject { | |
#get file ID | |
files.stdWrap { | |
data = parameters:href | |
stdWrap.replacement { | |
10 { | |
search = t3://file?uid= | |
replace = | |
} | |
} | |
} | |
renderObj = COA | |
renderObj { | |
required = 1 | |
stdWrap { | |
wrap = |<sup>( \ )</sup> | |
wrap.splitChar = \ | |
} | |
# Extension | |
10 = TEXT | |
10 { | |
data = file:current:extension | |
case = upper | |
} | |
# size | |
20 = TEXT | |
20 { | |
noTrimWrap = |, || | |
data = file:current:size | |
bytes = 1 | |
bytes.labels = "| kb| mb| gb" | |
} | |
# modification date | |
30 = TEXT | |
30 { | |
noTrimWrap = |, || | |
data = file:current:modification_date | |
strftime = %d.%m.%Y | |
} | |
30 > | |
} | |
} | |
} | |
} | |
lib.parseFunc_RTE.tags.a.typolink { | |
ATagBeforeWrap = 1 | |
wrap.cObject < lib.parseFunc.tags.a.typolink.wrap.cObject | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment