After finally getting around to using hook_views_post_render() as per the example I noticed a horrible error in the example. Instead of the $replace_pairs array parameter being an associative array it is an indexed array, which means any occurrence of the string "0" in $output will be replaced by "

" and likewise for the string "1" by "output for FIELD of nid 1".

Anyway, patch attached.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tim.plunkett’s picture

Title: strtr() example in views.api.php is horribly wrong » Fix the incorrect usage of strtr() in views.api.php
Assigned: Unassigned » dawehner
Status: Needs review » Reviewed & tested by the community

Good catch!

dawehner’s picture

Status: Reviewed & tested by the community » Fixed

Looks perfect, thanks!
Committed to 7.x-3.x

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.