Dear Experts,

Is there anyone to let me know how I can render fields value in themename_preprocess_views_view_list () template programmatically!?

I have tried this but it is not working:

themename_preprocess_views_view_list (&$variables) {
$view = $variables['view'];
$rows = $variables['rows'];

foreach ($rows as $id => $row){
print $view->result[$id]->field_name;
}
}

Thanks for any quick response
MahPari

Comments

mahpari created an issue. See original summary.

priyarm’s picture

Hi,

function themename_preprocess_views_view_list(&$variables) {
$view = $variables['view'];
$id = $view->storage->id();
$rows = $variables['rows'];
foreach ($rows as $rowId => $row) {
foreach ($view->field as $fieldId => $field) {
$field_output = $view->style_plugin->getFieldValue($rowId, $fieldId);
print_r($view->field[$fieldId]->label());
print_r($field_output);

}
}
}

renatog’s picture

Status: Active » Reviewed & tested by the community

Thank you very much for your help @priyarm.

Best,

renatog’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.