diff --git a/core/modules/views/src/Annotation/ViewsAggregate.php b/core/modules/views/src/Annotation/ViewsAggregate.php new file mode 100644 index 00000000000..55d702e6cd8 --- /dev/null +++ b/core/modules/views/src/Annotation/ViewsAggregate.php @@ -0,0 +1,85 @@ +getDefinitions(); + asort($plugin_definitions); return array( 'group' => array( 'title' => $this->t('Group results together'), 'is aggregate' => FALSE, ), - 'count' => array( - 'title' => $this->t('Count'), - 'method' => 'aggregationMethodSimple', - 'handler' => array( - 'argument' => 'groupby_numeric', - 'field' => 'numeric', - 'filter' => 'groupby_numeric', - 'sort' => 'groupby_numeric', - ), - ), - 'count_distinct' => array( - 'title' => $this->t('Count DISTINCT'), - 'method' => 'aggregationMethodDistinct', - 'handler' => array( - 'argument' => 'groupby_numeric', - 'field' => 'numeric', - 'filter' => 'groupby_numeric', - 'sort' => 'groupby_numeric', - ), - ), - 'sum' => array( - 'title' => $this->t('Sum'), - 'method' => 'aggregationMethodSimple', - 'handler' => array( - 'argument' => 'groupby_numeric', - 'field' => 'numeric', - 'filter' => 'groupby_numeric', - 'sort' => 'groupby_numeric', - ), - ), - 'avg' => array( - 'title' => $this->t('Average'), - 'method' => 'aggregationMethodSimple', - 'handler' => array( - 'argument' => 'groupby_numeric', - 'field' => 'numeric', - 'filter' => 'groupby_numeric', - 'sort' => 'groupby_numeric', - ), - ), - 'min' => array( - 'title' => $this->t('Minimum'), - 'method' => 'aggregationMethodSimple', - 'handler' => array( - 'argument' => 'groupby_numeric', - 'field' => 'numeric', - 'filter' => 'groupby_numeric', - 'sort' => 'groupby_numeric', - ), - ), - 'max' => array( - 'title' => $this->t('Maximum'), - 'method' => 'aggregationMethodSimple', - 'handler' => array( - 'argument' => 'groupby_numeric', - 'field' => 'numeric', - 'filter' => 'groupby_numeric', - 'sort' => 'groupby_numeric', - ), - ), - 'stddev_pop' => array( - 'title' => $this->t('Standard deviation'), - 'method' => 'aggregationMethodSimple', - 'handler' => array( - 'argument' => 'groupby_numeric', - 'field' => 'numeric', - 'filter' => 'groupby_numeric', - 'sort' => 'groupby_numeric', - ), - ) - ); + ) + $plugin_definitions; } public function aggregationMethodSimple($group_type, $field) { diff --git a/core/modules/views/views.services.yml b/core/modules/views/views.services.yml index 1a01543c674..a01318864ba 100644 --- a/core/modules/views/views.services.yml +++ b/core/modules/views/views.services.yml @@ -56,6 +56,9 @@ services: plugin.manager.views.wizard: class: Drupal\views\Plugin\ViewsPluginManager arguments: [wizard, '@container.namespaces', '@cache.discovery', '@module_handler'] + plugin.manager.views.aggregate: + class: Drupal\views\Plugin\ViewsPluginManager + arguments: [aggregate, '@container.namespaces', '@cache.discovery', '@module_handler'] views.views_data: class: Drupal\views\ViewsData arguments: ['@cache.discovery', '@config.factory', '@module_handler', '@language_manager']