filtering link types?
bkat - August 23, 2007 - 02:44
| Project: | Related links |
| Version: | 5.x-1.0 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Is there a built in way of filtering links? For example, I don't want mailto links showing up in the parsed links. I made a quick hack in _relatedlinks_filter to do this but it really should be a config option:
function _relatedlinks_filter($links) {
$urls = array();
$url_cache = array();
foreach ($links as $link) {
if (!in_array($link['url'], $url_cache)) {becomes
function _relatedlinks_filter($links) {
$urls = array();
$url_cache = array();
foreach ($links as $link) {
// kjh: added filter of mailto links
if (!in_array($link['url'], $url_cache) && !preg_match('/^mailto:/i', $link['url'])) {
#1
Actually, a more general approach would be useful. It would be handy to filter by link class. Likewise, I need to trim some links that are very long that also include . Right now I use a similar hack.
#2
This is useful but also there should be some node override on the content type. Sometimes you do not want parse links displayed on 1 or 2 content items in a content type but that cannot be controled as it's listed only on the module configuration. Maybe limit it only to admins.