You are here

function _filter_url_trim in Drupal 10

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

Shortens a long URL to a given length ending with an ellipsis.

Related topics

4 calls to _filter_url_trim()
_filter_url in core/modules/filter/filter.module
Converts text into hyperlinks automatically.
_filter_url_parse_email_links in core/modules/filter/filter.module
Makes links out of email addresses.
_filter_url_parse_full_links in core/modules/filter/filter.module
Makes links out of absolute URLs.
_filter_url_parse_partial_links in core/modules/filter/filter.module
Makes links out of domain names starting with "www.".

File

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

Code

function _filter_url_trim($text, $length = NULL) {
  static $_length;
  if ($length !== NULL) {
    $_length = $length;
  }
  if (isset($text) && isset($_length)) {
    $text = Unicode::truncate($text, $_length, FALSE, TRUE);
  }
  return $text;
}