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'])) {

Comments

bwong’s picture

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.

usera’s picture

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.

Zen’s picture

Title: filtering link types? » Add configuratoin option for URL types
Version: 5.x-1.0 » 6.x-1.x-dev
Category: support » feature
Zen’s picture

Title: Add configuratoin option for URL types » Add configuration option for URL types