You can do it in the template itself quite simply, something like:
<?php foreach ($row->field_my_field as $data): ?>
<?php if ($data['raw']['value'] == 'o'): ?>
// Output nothing, or placeholder, whatever
<?php else: ?>
<?php print $data['rendered']['#markup']; ?>
<?php endif; ?>
<?php endforeach; ?>
This is a custom template for that particular field, and so should only be used with it (which can be done via preprocess). You might also need to be careful about the name of the field changing if the field's changed in the View.
The nicest approach I can think of is probably using hook_field_attach_view_alter()
:
function MYMODULE_field_attach_view_alter(&$output, $context) {
$field_name = 'field_test';
$to_hide = array('o');
if (isset($output[$field_name]['#field_name'])) {
if ($field_name == $output[$field_name]['#field_name']) {
foreach ($output[$field_name]['#items'] as $delta => $item) {
if (in_array($item['value'], $to_hide)) {
unset($output[$field_name][$delta]);
}
}
}
}
}
That will work for Views and a normal entity view. AFAIK you can use $context
to detect whether you're in a View or not, but I can't remember what you'd check for exactly. (And if you later find you do want to display the field like this outside of Views, it's painless to change.)
HTH
$row->field_my_field
and doing whatever you want?