function farm_flags_views_pre_render in farmOS 7
Implements hook_views_pre_render().
File
- modules/
farm/ farm_flags/ farm_flags.module, line 89 - Farm flags module.
Code
function farm_flags_views_pre_render(&$view) {
// If there are no results, bail early.
if (empty($view->result)) {
return;
}
// Iterate through results.
foreach ($view->result as $item) {
// If there are no flags, skip it.
if (empty($item->field_field_farm_flags)) {
continue;
}
// Wrap flags in a span with a class.
foreach ($item->field_field_farm_flags as &$flag) {
$string = $flag['rendered']['#markup'];
$class = $flag['raw']['value'];
$flag['rendered']['#markup'] = farm_flags_wrap($string, $class);
}
}
}