Drupal 8 hook example: hook_views_pre_render

You can modify view before rendering

  1. function fintech_alters_views_pre_render(\Drupal\views\ViewExecutable $view) {
  2. if($view->id() == 'view_id' && $view->current_display == 'display_id' ){
  3.  
  4. $variables['title'] = 'new view title';
  5.  
  6. foreach($view->result as $key => $value){
  7. $title = $value->_entity->get('title')->value;
  8. $value->_entity->set('title', 'new title');
  9. // Some actions
  10. }
  11. }
  12. }