trait WebformSubmissionCastToNumberTrait in Webform Views Integration 8.5
Trait to cast a SQL expression to numeric data type.
Hierarchy
- trait \Drupal\webform_views\Plugin\views\WebformSubmissionCastToNumberTrait
3 files declare their use of WebformSubmissionCastToNumberTrait
- WebformSubmissionFieldNumeric.php in src/
Plugin/ views/ field/ WebformSubmissionFieldNumeric.php - WebformSubmissionFieldNumericSort.php in src/
Plugin/ views/ sort/ WebformSubmissionFieldNumericSort.php - WebformSubmissionNumericFilter.php in src/
Plugin/ views/ filter/ WebformSubmissionNumericFilter.php
File
- src/
Plugin/ views/ WebformSubmissionCastToNumberTrait.php, line 8
Namespace
Drupal\webform_views\Plugin\viewsView source
trait WebformSubmissionCastToNumberTrait {
/**
* Cast a given SQL snippet to data type expected by this handler.
*
* @param string $value
* SQL snippet that should be casted
*
* @return string
* SQL snippet that casts provided $value to necessary data type
*/
protected function castToDataType($value) {
return "({$value} + 0)";
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
WebformSubmissionCastToNumberTrait:: |
protected | function | Cast a given SQL snippet to data type expected by this handler. |