hook_views_post_execute(ViewExecutable() not working after update to 10.4.6

Created on 12 April 2025, 14 days ago

Problem/Motivation

I have 4 custom entities (DistributionInscription, DistributionDate, Person and Member) and one View (see Capture1).
The corresponding configuration file is `views.view.amap_planning.yml`.
I have a hook_views_post_execute(ViewExecutable() that "rewrites" one of the field of the view (Distribution inscription: Created) to show a rank:

<?php
function amap_views_post_execute(ViewExecutable $view) {
  switch ($view->id()) {
    case 'amap_planning':
      switch ($view->current_display) {
        case 'page_1':
        case 'page_2':
          $rank = 0;
          $numberofinscriptions = 0;
          foreach ($view->result as $row) {
            if ($row->distribution_inscription_id == $numberofinscriptions) {
              $row->distribution_inscription_created = 0;
            }
            else {
              $rank++;
              $numberofinscriptions = $row->distribution_inscription_id;
              $row->distribution_inscription_created = $rank;
            }
          }
          break;
        default:
          break;
      }
      break;
    default:
      break;
  }
}
?>

You may see the result of the view in Capture2.
In fact, it was the result before I updated Drupal to version 10.4.6.
Since then, the calculated rank is not taken into account (as if hook doesn't work anymore) and you may see the result in Capture3.
I noticed a difference in the View itself:
Before the update, the field 'Distribution inscription: Created' seems to be a number as you can see in Capture4a
After the update, the field 'Distribution inscription: Created' seems to be a date as you can see in Capture4d. Which explains the output of the view in column 1.
How is it possible?
Why doesn't the hook work anymore?

🐛 Bug report
Status

Active

Version

10.4

Component

other

Created by

🇫🇷France gbmapo

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024