Answer the question
In order to leave comments, you need to log in
How to replace all spaces with underscores as a result of views output in a text field?
How to replace all spaces with underscores as a result of views output in a text field? Probably you can create a field template, but maybe there is another way? Thank you.
Answer the question
In order to leave comments, you need to log in
Something like this:
function YOU_MODULE_NAME_preprocess_views_view_field(&$vars) {
$view = $vars['view'];
$field = $vars['field'];
if ($view->name == 'name' && $view->current_display == 'display' && $field->field_alias == 'alias') {
$vars['output'] = str_replace(' ', '_', $vars['output']);
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question