简体   繁体   English

ViewHelper,用于来自链接向导的链接

[英]ViewHelper for links from link wizard

I search a ViewHelper which helps to recognize, wether a link from the link wizard is a page link, a file link or an external link. 我搜索了一个ViewHelper,它有助于识别链接向导中的链接是页面链接,文件链接还是外部链接。

The reason for this is: i must include different icons depending from the link type, eG 原因是:根据链接类型eG,我必须包含不同的图标

header_link => '33'
header_link => 't3://file?uid=44'
header_link => 'spiegel.de' 

There is no viewhelper for this out of the box. 开箱即用没有viewhelper。 You could write your own viewhelper which uses \\TYPO3\\CMS\\Core\\LinkHandling\\LinkService::resolve() to determine the type. 您可以编写自己的viewhelper,它使用\\TYPO3\\CMS\\Core\\LinkHandling\\LinkService::resolve()确定类型。

However I'd suggest to do this via CSS instead: 但是我建议改为通过CSS执行此操作:

a[href^='http'] { /* external */ }
a[href^='/'] { /* internal */ }
a[href$='.pdf'] { /* pdf */ }
/* etc. */

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM