I'm using the views_summarize module, which adds a custom View display style. The display style is basically a Table view but it allows you to display a summary of a column in a row at the bottom of the table in a variety of formats you can choose from.

Views summarize formats

I need to add a custom format to this list and in the Drupal 7 version of the module this could be done with hooks (see here). But since it was updated for Drupal 8/9 I can't figure out how to extend the display style plugin or if it's even possible.

I would ask the module developers but I don't think they've touched the module in a couple years, hoping someone can point me in the right direction here. Cheers!

1 Answer 1


After extending the plugin class



namespace Drupal\mymodule\Plugin\views\style;

use Drupal\views_summarize\Plugin\views\style\TableSummarized;

class MyTableSummarized extends TableSummarized {

  protected function getHandlers() {
    $handlers = parent::getHandlers();
    // add your own handler
    $handlers['bar'] = 'Bar';
    return $handlers;


you can replace the class in the plugin manager:


function mymodule_views_plugins_style_alter(array &$info) {
  if (isset($info['tablesummarized'])) {
    $info['tablesummarized']['class'] = '\Drupal\mymodule\Plugin\views\style\MyTableSummarized';

See How do I replace a plugin?

  • Perfect, thank you!
    – Mitchell
    Sep 9, 2022 at 0:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.