Skip to content

Instantly share code, notes, and snippets.

@lehelmatyus
Created May 19, 2017 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lehelmatyus/abb07bf463e38ea701f06289162ec0f4 to your computer and use it in GitHub Desktop.
Save lehelmatyus/abb07bf463e38ea701f06289162ec0f4 to your computer and use it in GitHub Desktop.
<?php
function logichub_preprocess_views_view_field(array &$variables){
$id = $variables['field']->realField;
if ($id == 'field_blog_authors_target_id') {// || $id==’field_image_target_id’
$terms = $variables['field']->getValue($variables['row']);
$tids = array();
foreach($terms as $t){
$tids[] = intval($t);
}
//log_status('tid' ''json_encode($tids));
$terms = \Drupal\taxonomy\Entity\Term::loadMultiple($tids);
$output = ”;
foreach ($terms as $term) {
$author_img_url = $term->field_author_image[0]->entity->uri->value;
$output .= '';
}
$variables['output'] = $output;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment