How to programmatically add a field to a view depending on another field and reorder fields then I broke a site yesterday using views global php, even if it was working in the preview, so I'm a bit nervious about that php in database and I'm trying to implement the same thing with Views API.

Depending on the key value of a hidden field in the current display, I need to put a custom text. Something like (global php version) :

if( isset($data) &amp;&amp; isset($data-&gt;field_field_statut_depart) ) {

  switch(  $data-&gt;field_field_statut_depart[0]['raw']['value'] ) {

    case 1: 
      $text = 'ABC';
      break;
    case 2: 
      $text = 'DEF';
      break;
    //and so on

  }
  print $text;
}


I'm trying to build it with hook_views_pre_view(&amp;$view, &amp;$display_id, &amp;$args) but I can't find the required field_statut_depart value in  dpm($view).

Maybe it's not the right hook ?

EDIT : after applying solution described in the answers below (views_post_execute hook) and 12 hours running, I'm facing a strange behaviour : the changes made by  views_post_execute hook are not stable : after clearing caches, they are visible for a while but raw data (without my function applied) is displayed then ! I'm afraid it's still not the right place to do that. Any help is welcome.
You may want to try the views_post_execute hook.

Otherwise there is a reduced list of hooks used for views rendering at the bottom of the Views Hooks API page.

It is a little hidden but I have used it many times and you may find a solution to your issue there.