function HandlerBase::caseTransform
Same name in other branches
- 9 core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::caseTransform()
- 8.9.x core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::caseTransform()
- 11.x core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::caseTransform()
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 HandlerBase::caseTransform()
- FieldPluginBase::renderAsLink in core/
modules/ views/ src/ Plugin/ views/ field/ FieldPluginBase.php - Render this field as a link, with the info from a fieldset set by the user.
- StringArgument::summaryArgument in core/
modules/ views/ src/ Plugin/ views/ argument/ StringArgument.php - Provides the argument to use to link from the summary to the next level.
- StringArgument::summaryName in core/
modules/ views/ src/ Plugin/ views/ argument/ StringArgument.php - Provides the name to use for the summary, defaults to the name field.
- StringArgument::title in core/
modules/ views/ src/ Plugin/ views/ argument/ StringArgument.php - Get the title this argument will assign the view, given the argument.
- StringListField::summaryName in core/
modules/ options/ src/ Plugin/ views/ argument/ StringListField.php - Provides the name to use for the summary, defaults to the name field.
File
-
core/
modules/ views/ src/ Plugin/ views/ HandlerBase.php, line 242
Class
- HandlerBase
- Base class for Views handler plugins.
Namespace
Drupal\views\Plugin\viewsCode
protected function caseTransform($string, $option) {
switch ($option) {
default:
return $string;
case 'upper':
return mb_strtoupper($string);
case 'lower':
return mb_strtolower($string);
case 'ucfirst':
return Unicode::ucfirst($string);
case 'ucwords':
return Unicode::ucwords($string);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.