Alter views fields using preprocess function before render? How do I edit a views field using preprocess before it is rendered to the screen?
Let's say the field originally outputs something like this:

Note title


now I want to change that adding the number of comments in that node

Node title (4 comments, 1 new)


I know I can achieve this with joining two fields together or altering the template (tpl) files for that particular field but I'd like to learn how to use preprocess function in order to achieve this.
Drupal 7

Either you have to use hook_views_pre_render() or create appropriate TPL file (e.g. views-view-fields--MYVIEW.tpl.php) in your template dir (check Theme:Information in view edit page for more details).

You may also use preprocess theme function to print a single record from a row, with fields which is template_preprocess_views_view_fields().

Related:


_preprocess_views_view__ specify view name
Drupal 7 preprocess_views not working
Specific preprocess functions for theme hook suggestions are not invoked