views_ui_truncate($string, $length)
Truncate strings to a set length and provide a '...' if they truncated.
This is often used in the UI to ensure long strings fit.
File
core/modules/views_ui/views_ui.module, line 321 Provide structure for the administrative interface to Views.
Code
function views_ui_truncate($string, $length) {
if (Unicode::strlen($string) > $length) {
$string = Unicode::substr($string, 0, $length);
$string .= '...';
}
return $string;
}