diff --git a/linkchecker.module b/linkchecker.module index a3a1a8b..448bb2f 100644 --- a/linkchecker.module +++ b/linkchecker.module @@ -1068,10 +1068,7 @@ function _linkchecker_extract_node_links($node, $return_field_names = FALSE) { // Return either the array of links, or an array of field names containing // each link, depending on what was requested. - if (!$return_field_names) { - return $links; - } - else { + if ($return_field_names) { $field_names = array(); foreach ($text_items_by_field as $field_name => $items) { foreach ($items as $item) { @@ -1095,9 +1092,16 @@ function _linkchecker_extract_node_links($node, $return_field_names = FALSE) { } } } - - return $field_names; + $links = $field_names; } + + $context = array( + 'return_field_names' => $return_field_names, + 'path' => $path, + ); + drupal_alter('linkchecker_node_links', $links, $node, $context); + + return $links; } /** @@ -1204,6 +1208,11 @@ function _linkchecker_add_comment_links($comment, $skip_missing_links_detection // Extract all links in a comment. $links = array_keys(_linkchecker_extract_links(implode(' ', $text_items), $path)); + $context = array( + 'path' => $path, + ); + drupal_alter('linkchecker_comment_links', $links, $comment, $context); + // Comment have links. if (!empty($links)) { // Remove all links from the links array already in the database and only @@ -1308,6 +1317,8 @@ function _linkchecker_add_block_custom_links($block_custom, $bid, $skip_missing_ // Extract all links in a custom block. $links = array_keys(_linkchecker_extract_links(implode(' ', $text_items))); + drupal_alter('linkchecker_block_links', $links, $block_custom); + // Custom block has links. if (!empty($links)) { // Remove all links from the links array already in the database and only