function views_handler::case_transform
3.x handlers.inc | views_handler::case_transform($string, $option) |
Transform a string by a certain method.
Parameters
$string: The input you want to transform.
$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.
5 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. By default this is just the name field.
- 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; this will be called once per row of a summary, and used as part of $view->get_url().
- views_handler_argument_string::summary_name in handlers/
views_handler_argument_string.inc - Provides the name to use for the summary. By default this is just the name field.
- 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 the info from a fieldset set by the user.
File
- includes/
handlers.inc, line 355 - Defines the various handler objects to help build and display views.
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
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);
}
}
}