function views_ui_truncate in Views (for Drupal 7) 8.3
Same name and namespace in other branches
- 7.3 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.
5 calls to views_ui_truncate()
- Block::optionsSummary in lib/
Views/ block/ Plugin/ views/ display/ Block.php - Provide the summary for page options in the views UI.
- DisplayExtenderTest::optionsSummary in 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 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 lib/
Drupal/ views/ Plugin/ views/ display/ Page.php - Provide the summary for page options in the views UI.
- ViewUI::getDisplayLabel in views_ui/
lib/ Drupal/ views_ui/ ViewUI.php - Placeholder function for overriding $display['display_title'].
File
- views_ui/
views_ui.module, line 709 - 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;
}