Currently, new values (created by any kind of aggregation) are rendered in render_new_value() (or render_new_webform_value()) by trying to duplicate the normal functionality of the field handler without using it. Necessarily, this mimicking of the field handler can never be perfect, especially when a module like Views Numeric Extras is used which provides additional options compared to the standard handler.
Of course, since the values in a row of aggregated values can be entirely different from those in a normal row, using the field handler (or the complete field settings) often doesn't make sense. However, I think it would be a great improvement to at least have the option to do this.

This might also provide a solution for issues like #2459411: Count column aggregation ignores empty option.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drunken monkey’s picture

Status: Active » Needs review
FileSize
5.37 KB

See the attached patch which would add exactly such an option.

drunken monkey’s picture

Re-roll without the whitespace changes.

RdeBoer’s picture

Hi Thomas,

Thank you for your report and the research that went into it.

So, in summary, to make Views Numeric Extras work for you, or rather your sponsor, we both know where this is coming from :-), you need me to change Views Aggregator Plus?

Views Aggregator Plus: 3300+ installs
Views Numeric Extras: 6 installs, seeking maintainer

It's almost a case of the tail wagging the dog isn't it?

But no worries, it is a very elegant patch that is low risk because of the checkbox you put in. Thanks.
And what you say about the wider benefits that it may have is true also -- well done.

So I'll apply it.
You get the $$$ and I get the bug reports :-)

Rik

RdeBoer’s picture

Ok, so couple of issues with the patch, one good, one not so good.

First, the tickbox actually works nicely on Group aggregation too. So I made it a general option, rather than a Column aggregation option.

Second, unfortunately the patch causes a WSOD on fields originating from Entities. I had to disallow the checkbox for a number of Views fields types (Entity field, PHP and Math Expression), due to the special nature in which these fields deal with (new) values.

      // Need this test as views_handler_field_field::get_value() drastically
      // overrides views_handler_field::get_value() and will expect an entity
      // to be present in $field_handler->view->result[$row_num]->_field_data 
      // and attempt to clone it, which results in WSOD when not there.
      // rendering this way is also no good for views_php_handler_fields and
      // views_handler_field_math fields
       if ($this->is_numeric_field($field_handler)) {
           // original patch code
       }

Having said that, I thank you again for your research and initial patch @drunken monkey. It certainly helped pushing me in the right direction.

  • RdeBoer committed 7341f9d on 7.x-1.x
    Improved version of Views Numeric Extras patch from [#2459875]
    
RdeBoer’s picture

FileSize
172.12 KB

NWOM’s picture

Status: Needs review » Fixed

This patch appears to have been implemented.

Status: Fixed » Closed (fixed)

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