function _termcase_convert_string_to_case in Termcase 6
Same name and namespace in other branches
- 8 termcase.module \_termcase_convert_string_to_case()
- 7 termcase.module \_termcase_convert_string_to_case()
Convert the string to the specified case
3 calls to _termcase_convert_string_to_case()
- termcase_taxonomy in ./
termcase.module - Implementation of hook_taxonomy().
- _termcase_update_all_terms in ./
termcase.module - Helper function to loop through all terms in the specified vocabulary and apply the case formatting to each of them
- _termcase_update_term_synonyms in ./
termcase.module - Update the term synonyms in the database
File
- ./
termcase.module, line 242 - The Termcase module gives you the option to specify specific case-formatting on terms.
Code
function _termcase_convert_string_to_case($string, $case = TERMCASE_NONE) {
$converted_string = $string;
switch ($case) {
case TERMCASE_UCFIRST:
$converted_string = drupal_ucfirst($string);
break;
case TERMCASE_LOWERCASE:
$converted_string = drupal_strtolower($string);
break;
case TERMCASE_UPPERCASE:
$converted_string = drupal_strtoupper($string);
break;
case TERMCASE_PROPERCASE:
$words = explode(' ', $string);
foreach ($words as $key => $word) {
$words[$key] = drupal_ucfirst($word);
}
$converted_string = implode(' ', $words);
break;
}
return $converted_string;
}