function _filter_url_trim

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

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

Deprecated

in drupal:11.4.0 and is removed from drupal:13.0.0. The logic has been included in \Drupal\filter\Plugin\Filter\FilterUrl::trimUrl() and no replacement is provided.

See also

https://www.drupal.org/node/3566774

Related topics

3 calls to _filter_url_trim()
_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 514

Code

function _filter_url_trim($text, $length = NULL) {
  @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. The logic has been included in \\Drupal\\filter\\Plugin\\Filter\\FilterUrl::trimUrl() and no replacement is provided. See https://www.drupal.org/node/3566774', E_USER_DEPRECATED);
  static $_length;
  if ($length !== NULL) {
    $_length = $length;
  }
  if (isset($text) && isset($_length)) {
    $text = Unicode::truncate($text, $_length, FALSE, TRUE);
  }
  return $text;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.