I’ve a (Apache solr) view with a International: Customized textual content
discipline along with my regular fields. This discipline is supposed to get worth from a customized operate/present discipline/passing an present discipline to a customized operate and utilizing return worth in certainly one of my modules per every consequence and I’m attempting to perform this performance with out utilizing Views PHP module.
I referred this very related question and tried the next method which didn’t yield me the consequence:
hook_views_pre_render
:
operate mymod_views_pre_render(&$view) {
if ($view->title == 'mymodview' && $view->current_display == 'mymod_display') {
$consequence = &$view->consequence;
foreach ($consequence as $num_idx => $result_obj) {
$consequence[$num_idx]->nothing = $result_obj->an_already_available_field_or_fxn_call;
}
}
}
Additionally tried the identical code with hook_views_post_execute
to no avail. Utilizing $view->discipline['nothing']->choices['alter']['text'] = 'My customized textual content';
set the default textual content worth to all fields which was not my desired consequence.
Based mostly on the put up linked earlier tried the next code in my theme’s template.php
template_preprocess_views_view_fields
:
operate mytheme_preprocess_views_view_fields(&$vars) {
$view = $vars['view'];
if ($view->title != 'mymodview' && $view->current_display != 'mymod_display') {
return;
}
foreach ($view->discipline as $id => $discipline) {
$vars['fields']['nothing']->content material = 'Some international customized textual content content material';
}
}
I’m unable to find out what I’m lacking out on owing to my relative inexperience with views performance and steerage on reaching this programatically can be a lot appreciated.