function views_ui_truncate

Same name in other branches
  1. 9 core/modules/views_ui/views_ui.module \views_ui_truncate()
  2. 8.9.x core/modules/views_ui/views_ui.module \views_ui_truncate()

Truncate strings to a set length and provide a '...' if they truncated.

This is often used in the UI to ensure long strings fit.

Deprecated

in drupal:10.3.0 and is removed from drupal:12.0.0. Use \Drupal\Component\Utility\Unicode::truncate().

See also

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

1 call to views_ui_truncate()
TruncateDeprecateTest::testDeprecateViewsUiTruncate in core/modules/views_ui/tests/src/Kernel/TruncateDeprecateTest.php
Tests the deprecation of views_ui_truncate() replaced by Unicode::truncate.

File

core/modules/views_ui/views_ui.module, line 352

Code

function views_ui_truncate($string, $length) {
    @trigger_error('views_ui_truncate() is deprecated in drupal:10.3.0 and is removed from drupal:12.0.0. Use \\Drupal\\Component\\Utility\\Unicode::truncate(). See https://www.drupal.org/node/3408283', E_USER_DEPRECATED);
    return Unicode::truncate($string, $length, FALSE, TRUE);
}

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