Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
bwong CreditAttribution: bwong commentedActually, 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.
Comment #2
usera CreditAttribution: usera commentedThis 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.
Comment #3
Zen CreditAttribution: Zen commentedComment #4
Zen CreditAttribution: Zen commented