views_ui_truncate

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;
}
doc_Drupal
2016-10-29 09:55:43
Comments
Leave a Comment

Please login to continue.