You are here

function _filter_url_parse_full_links in Drupal 8

Same name and namespace in other branches
  1. 5 modules/filter/filter.module \_filter_url_parse_full_links()
  2. 6 modules/filter/filter.module \_filter_url_parse_full_links()
  3. 7 modules/filter/filter.module \_filter_url_parse_full_links()
  4. 9 core/modules/filter/filter.module \_filter_url_parse_full_links()

Makes links out of absolute URLs.

Callback for preg_replace_callback() within _filter_url().

Related topics

File

core/modules/filter/filter.module, line 594
Framework for handling the filtering of content.

Code

function _filter_url_parse_full_links($match) {

  // The $i:th parenthesis in the regexp contains the URL.
  $i = 1;
  $match[$i] = Html::decodeEntities($match[$i]);
  $caption = Html::escape(_filter_url_trim($match[$i]));
  $match[$i] = Html::escape($match[$i]);
  return '<a href="' . $match[$i] . '">' . $caption . '</a>';
}