function 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.

6 calls to views_ui_truncate()
Block::optionsSummary in drupal/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php
Provide the summary for page options in the views UI.
DisplayExtenderTest::optionsSummary in drupal/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/display_extender/DisplayExtenderTest.php
Overrides Drupal\views\Plugin\views\display\DisplayPluginBase::optionsSummary().
DisplayTest::optionsSummary in drupal/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/display/DisplayTest.php
Overrides Drupal\views\Plugin\views\display\DisplayPluginBase::optionsSummaryv().
Page::optionsSummary in drupal/core/modules/views/lib/Drupal/views/Plugin/views/display/Page.php
Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::optionsSummary().
PathPluginBase::optionsSummary in drupal/core/modules/views/lib/Drupal/views/Plugin/views/display/PathPluginBase.php
Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::optionsSummary().

... See full list

File

drupal/core/modules/views_ui/views_ui.module, line 454
Provide structure for the administrative interface to Views.

Code

function views_ui_truncate($string, $length) {
  if (drupal_strlen($string) > $length) {
    $string = drupal_substr($string, 0, $length);
    $string .= '...';
  }
  return $string;
}