Here's a patch to let other modules define additional handlers.

example usage:

/**
 * Implements hook_views_summarize_handlers().
 */
function my_module_views_views_summarize_handlers() {
  return array(
    'my_module_views_summarize_hours_min'     => t('Hours and Minutes'),
  );
}


/*
 * Implementation of hook_theme()
 */
function my_module_views_theme() {
  return array(
    'my_module_views_summarize_hours_min' => array(
      'variables' => array('data' => array()),
    ),
  );
}

/**
 * Theme: format minutes as hours minutes
 */
function theme_my_module_views_summarize_hours_min($variables) {
  $data = $variables['data'];
  return '<div class="label">' . format_interval(array_sum($data),2) . '</div>';
}

Comments

light9’s picture

Just thank you for this path. Works for me!

oadaeh’s picture

Status: Needs review » Needs work

I've done quite a bit of updating to fix a number of bugs. Would you mind updating your patch with the current code?

Also, do you have anything I can test this out with, so that I know it's working?

lionsharz’s picture

what does this patch do? i was looking for a way to subtract the Row Count Sum from one view from another (separate) view. This isn't normally possible given limitation of merging / combining views but perhaps this patch allows other modules to pull views summarize data(?)

drasgardian’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new2.09 KB

The attached patch should apply to the latest dev

letrotteur’s picture

Works great! Thank you so much for this patch.

oadaeh’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Assigned: Unassigned » oadaeh
oadaeh’s picture

I'll be putting this in the new 7.x-2.x branch, so as not to disrupt people who are fine with what has been working for them.

  • oadaeh committed af523ca on 7.x-2.x authored by John Morahan
    Issue #1448384 by drasgardian, John Morahan, oadaeh, light9, letrotteur...
oadaeh’s picture

Assigned: oadaeh » Unassigned
Status: Needs review » Fixed

I've committed this. I added a README.txt (which is a good idea on its own) to include the example usage (which I had to correct due to a bug).

oadaeh’s picture

oadaeh’s picture

oadaeh’s picture

Hmm, the system does not seem to be giving @John Morahan credit, even though he's checked.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.