I would like to do math on counts of two aggregated fields. In views post render the final results are located under $view->style_plugin->rendered_fields[0] and they are generated by views aggregator plus.

I wrote a foreach loop that iterate through the results like this

 if ($view->id() == 'stuff' && $view->getDisplay()->display['id'] == 'morestuff') {
foreach ($view->result as $id => $row) {
  $value = $view->style_plugin->getField($id,'field_1');
  $value2 = $view->style_plugin->getField($id,'field_2');

And there I am stuck because I don't know how to set a style plugin field value. Maybe I am not supposed to do it there because the hook documentation is confusing about the role of $output as can be seen here and here.

So, how would you do this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.