I would like to perform a string replace function on a field in views. What is the best way to access and change the value? A template will not work as the view is being output as JSON.
Is the best way hook_field_views_data_alter? If so I am having trouble implementing it in a module.
Or can I do this with a preprocess function? I tried the following. I can change the value but when I assign it back it is not output in the view.
function mytheme_preprocess_views_view_fields(&$variables) {
$view = $variables['view'];
$row = $variables['row'];
$new_value = str_replace ( '.' , ',' , $row -> node__field_product_price_field_product_price_value );
$row -> node__field_product_price_field_product_price_value = $new_value;
}