You are here

function views_ui_truncate in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 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.

9 calls to views_ui_truncate()
Block::optionsSummary in core/modules/views/src/Plugin/views/display/Block.php
Provide the summary for page options in the views UI.
DisplayExtenderTest::optionsSummary in core/modules/views/tests/modules/views_test_data/src/Plugin/views/display_extender/DisplayExtenderTest.php
Provide the default summary for options in the views UI.
DisplayPluginBase::optionsSummary in core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
Provides the default summary for options in the views UI.
DisplayTest::optionsSummary in core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php
Provides the default summary for options in the views UI.
DisplayTest::testDisplayTitleInButtonsXss in core/modules/views_ui/src/Tests/DisplayTest.php
Ensures that no XSS is possible for buttons.

... See full list

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;
}