protected function OptionsLimitWebformHandler::getOptionsTotals in Webform 6.x
Same name and namespace in other branches
- 8.5 modules/webform_options_limit/src/Plugin/WebformHandler/OptionsLimitWebformHandler.php \Drupal\webform_options_limit\Plugin\WebformHandler\OptionsLimitWebformHandler::getOptionsTotals()
Get options submission totals for the current webform and source entity.
Parameters
array $values: Optional array of values to get totals.
Return value
array A key/value array of options totals.
1 call to OptionsLimitWebformHandler::getOptionsTotals()
- OptionsLimitWebformHandler::getOptionsLimits in modules/
webform_options_limit/ src/ Plugin/ WebformHandler/ OptionsLimitWebformHandler.php - Get an associative array of options limits.
File
- modules/
webform_options_limit/ src/ Plugin/ WebformHandler/ OptionsLimitWebformHandler.php, line 1283
Class
- OptionsLimitWebformHandler
- Webform options and boolean (boolean) limit handler.
Namespace
Drupal\webform_options_limit\Plugin\WebformHandlerCode
protected function getOptionsTotals(array $values = []) {
$query = $this
->getTotalQuery();
if (!$query) {
return [];
}
$query
->addExpression('COUNT(value)', 'total');
$query
->groupBy('value');
if ($values) {
$query
->condition('sd.value', $values, 'IN');
}
return $query
->execute()
->fetchAllKeyed();
}