function views_handler::case_transform

Transform a string by a certain method.

Parameters

string $string: The input you want to transform.

array $option: How do you want to transform it, possible values:

  • upper: Uppercase the string.
  • lower: lowercase the string.
  • ucfirst: Make the first char uppercase.
  • ucwords: Make each word in the string uppercase.

Return value

string The transformed string.

6 calls to views_handler::case_transform()
views_handler_argument_field_list_string::summary_name in modules/field/views_handler_argument_field_list_string.inc
Provides the name to use for the summary.
views_handler_argument_string::summary_argument in handlers/views_handler_argument_string.inc
Provide the argument to use to link from the summary to the next level.
views_handler_argument_string::summary_name in handlers/views_handler_argument_string.inc
Provides the name to use for the summary.
views_handler_argument_string::title in handlers/views_handler_argument_string.inc
Get the title this argument will assign the view, given the argument.
views_handler_field::render_as_link in handlers/views_handler_field.inc
Render this field as a link, with info from a fieldset set by the user.

... See full list

File

includes/handlers.inc, line 371

Class

views_handler
Base handler, from which all the other handlers are derived. It creates a common interface to create consistency amongst handlers and data.

Code

public function case_transform($string, $option) {
    global $multibyte;
    switch ($option) {
        default:
            return $string;
        case 'upper':
            return drupal_strtoupper($string);
        case 'lower':
            return drupal_strtolower($string);
        case 'ucfirst':
            return drupal_strtoupper(drupal_substr($string, 0, 1)) . drupal_substr($string, 1);
        case 'ucwords':
            if ($multibyte == UNICODE_MULTIBYTE) {
                return mb_convert_case($string, MB_CASE_TITLE);
            }
            else {
                return ucwords($string);
            }
    }
}