diff --git a/core/modules/views/src/Plugin/views/HandlerBase.php b/core/modules/views/src/Plugin/views/HandlerBase.php index ef76b57369..a930a6dc3c 100644 --- a/core/modules/views/src/Plugin/views/HandlerBase.php +++ b/core/modules/views/src/Plugin/views/HandlerBase.php @@ -802,7 +802,13 @@ public function submitTemporaryForm($form, FormStateInterface $form_state) { $executable->initQuery(); } $aggregate = $executable->query->getAggregationInfo(); - if (!empty($aggregate[$item['group_type']]['handler'][$type])) { + if ( + !empty($aggregate[$item['group_type']]['handler'][$type]) + && ( + empty($aggregate[$item['group_type']]['handler']['exclude']) + || !in_array($item['type'], $aggregate[$item['group_type']]['handler']['exclude']) + ) + ) { $override = $aggregate[$item['group_type']]['handler'][$type]; } } diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php index 0d89fb724b..b5b20da0dc 100644 --- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php @@ -851,6 +851,11 @@ public function &getHandlers($type) { $types = ViewExecutable::getHandlerTypes(); $plural = $types[$type]['plural']; + $handler_type = $type; + if (!empty($types[$type]['type'])) { + $handler_type = $types[$type]['type']; + } + // Cast to an array so that if the display does not have any handlers of // this type there is no PHP error. foreach ((array) $this->getOption($plural) as $id => $info) { @@ -874,18 +879,20 @@ public function &getHandlers($type) { $this->view->initQuery(); } $aggregate = $this->view->query->getAggregationInfo(); - if (!empty($aggregate[$info['group_type']]['handler'][$type])) { + + if ( + !empty($aggregate[$info['group_type']]['handler'][$type]) + && ( + empty($aggregate[$info['group_type']]['handler']['exclude']) + || ( + isset($info['type']) && + !in_array($info['type'], $aggregate[$info['group_type']]['handler']['exclude'])) + ) + ) { $override = $aggregate[$info['group_type']]['handler'][$type]; } } - if (!empty($types[$type]['type'])) { - $handler_type = $types[$type]['type']; - } - else { - $handler_type = $type; - } - if ($handler = Views::handlerManager($handler_type)->getHandler($info, $override)) { // Special override for area types so they know where they come from. if ($handler instanceof AreaPluginBase) { diff --git a/core/modules/views/src/Plugin/views/query/Sql.php b/core/modules/views/src/Plugin/views/query/Sql.php index 96968b5e32..b5acd6a70e 100644 --- a/core/modules/views/src/Plugin/views/query/Sql.php +++ b/core/modules/views/src/Plugin/views/query/Sql.php @@ -1777,6 +1777,12 @@ public function getAggregationInfo() { 'field' => 'numeric', 'filter' => 'groupby_numeric', 'sort' => 'groupby_numeric', + 'exclude' => [ + 'datetime_default', + 'datetime_custom', + 'datetime_plain', + 'datetime_time_ago', + ], ], ], 'max' => [ @@ -1787,6 +1793,12 @@ public function getAggregationInfo() { 'field' => 'numeric', 'filter' => 'groupby_numeric', 'sort' => 'groupby_numeric', + 'exclude' => [ + 'datetime_default', + 'datetime_custom', + 'datetime_plain', + 'datetime_time_ago', + ], ], ], 'stddev_pop' => [ diff --git a/core/modules/views_ui/src/Form/Ajax/ConfigHandler.php b/core/modules/views_ui/src/Form/Ajax/ConfigHandler.php index 20f61fe773..1eb21c15c7 100644 --- a/core/modules/views_ui/src/Form/Ajax/ConfigHandler.php +++ b/core/modules/views_ui/src/Form/Ajax/ConfigHandler.php @@ -227,7 +227,13 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $executable->initQuery(); } $aggregate = $executable->query->getAggregationInfo(); - if (!empty($aggregate[$item['group_type']]['handler'][$type])) { + if ( + !empty($aggregate[$item['group_type']]['handler'][$type]) + && ( + empty($aggregate[$item['group_type']]['handler']['exclude']) + || !in_array($item['type'], $aggregate[$item['group_type']]['handler']['exclude']) + ) + ) { $override = $aggregate[$item['group_type']]['handler'][$type]; } }