Created
May 19, 2017 15:54
-
-
Save lehelmatyus/abb07bf463e38ea701f06289162ec0f4 to your computer and use it in GitHub Desktop.
debug help for commenter http://www.lehelmatyus.com/659/drupal-8-views-field-templates-naming-convention#comment-857
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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