function _name_format_apply_modifiers in Name Field 6
Same name and namespace in other branches
- 7 includes/name.parser.inc \_name_format_apply_modifiers()
1 call to _name_format_apply_modifiers()
- _name_format_add_component in includes/
name.parser.inc
File
- includes/
name.parser.inc, line 246 - Provides the functionality and information about the Name module name parsing engine.
Code
function _name_format_apply_modifiers($string, $modifiers) {
if (!is_null($string) || strlen($string)) {
if ($modifiers) {
$_pre = $string;
for ($j = 0; $j < strlen($modifiers); $j++) {
switch ($modifiers[$j]) {
case 'L':
$string = drupal_strtolower($string);
break;
case 'U':
$string = drupal_strtoupper($string);
break;
case 'F':
$string = drupal_ucfirst($string);
break;
case 'G':
if (!empty($string)) {
$parts = explode(' ', $string);
$string = array();
foreach ($parts as $part) {
$string[] = drupal_ucfirst($part);
}
$string = implode(' ', $string);
}
break;
case 'T':
$string = trim($string);
break;
case 'S':
$string = check_plain($string);
break;
}
}
}
}
return $string;
}