DAM
1.5.5. RTE and <media> tag
During installation, the new typotag <media> can be enabled. This tag is similar to <link> with the difference that the given id is not a page but a media id.
Depending on the load order of installed extensions it may be needed to add manually the media tag processing to the RTE processing rules in page TSconfig:
## Add txdam_media to RTE processing rules
RTE.default.proc.overruleMode = ts_css,txdam_media
## Use same RTE processing rules in FE
RTE.default.FE.proc.overruleMode = ts_css,txdam_media
## RTE processing rules for bodytext column of tt_content table
RTE.config.tt_content.bodytext.proc.overruleMode = ts_css,txdam_media
RTE.config.tt_content.bodytext.types.text.proc.overruleMode = ts_css,txdam_media
RTE.config.tt_content.bodytext.types.textpic.proc.overruleMode = ts_css,txdam_media
Why is the media tag needed?
This is because it wouldn't be possible to link assets by reference. This means whenever a link to a file is created in the RTE the file path is saved. But when the file is renamed or moved this reference is lost. The media tag use the media id instead (tx_dam.uid) and the file link will be created while FE rendering.
Activating the media tag in the EM extension options will also install a transformation handler which overrides the default ts_links mode (used also when ts_css shortcut is configured). Processing of links in db direction will be done by that handler, which searches for linked files in A tags that can be substituted with a media tag.
The media tag will be rendered in the frontend by the plugin plugin.tx_dam_tsfemediatag which is registered in the TypoScript setup of lib.parseFunc.tags and lib.parseFunc_RTE.tags.
plugin.tx_dam_tsfemediatag {
procFields {
file_size = 1
}
tag {
current = 1
typolink.parameter.data = parameters : allParams
typolink.extTarget = {$styles.content.links.extTarget}
typolink.target = {$styles.content.links.target}
typolink.title {
dataWrap = { field : txdam_file_name } ({ field : txdam_file_size })
htmlspecialchars = 1
}
parseFunc.constants =1
}
}
lib.parseFunc.tags.media = < plugin.tx_dam_tsfemediatag
lib.parseFunc_RTE.tags.media = < plugin.tx_dam_tsfemediatag
As you see the fields from the tx_dam table are available in the typolink setup prefixed with txdam_. While the setup is very similar to the default link tag setup, the used typolink function is NOT the one available in stdWrap but has more or less the same properties.