Skip to content

Instantly share code, notes, and snippets.

@Megafry
Last active November 5, 2020 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Megafry/518d9015a67717279b8dc2f0cab41efd to your computer and use it in GitHub Desktop.
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
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>&#40; \ &#41;</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