You are here

function views_ui_truncate in Views (for Drupal 7) 7.3

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

5 calls to views_ui_truncate()
views_plugin_display::options_summary in plugins/views_plugin_display.inc
Provide the default summary for options in the views UI.
views_plugin_display::option_link in plugins/views_plugin_display.inc
Because forms may be split up into sections, this provides an easy URL to exactly the right section. Don't override this.
views_plugin_display_block::options_summary in plugins/views_plugin_display_block.inc
Provide the summary for page options in the views UI.
views_plugin_display_page::options_summary in plugins/views_plugin_display_page.inc
Provide the summary for page options in the views UI.
views_ui_get_display_label in includes/admin.inc
Placeholder function for overriding $display->display_title.

File

./views_ui.module, line 924
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;
}