Skip to content

Instantly share code, notes, and snippets.

@allgood2386
Created September 25, 2013 15:27
Show Gist options
  • Save allgood2386/6701334 to your computer and use it in GitHub Desktop.
Save allgood2386/6701334 to your computer and use it in GitHub Desktop.
<?php
/**
* Created by JetBrains PhpStorm.
* User: richallen
* Date: 9/25/13
* Time: 11:26 AM
* To change this template use File | Settings | File Templates.
*/
$tidList = array();
$termObjectArray = array();
$links = array();
foreach ($entity->field_related_topics['und'] as $tidArray) {
$tidList[] = $tidArray['tid'];
}
foreach ($entity->field_related_campaigns['und'] as $tidArray) {
$tidList[] = $tidArray['tid'];
}
foreach ($tidList as $tid) {
$termObjectArray[] = taxonomy_term_load($tid);
}
foreach ($termObjectArray as $term) {
$termPathArray = taxonomy_term_uri($term);
$termPath = drupal_get_path_alias($termPathArray['path']);
$links[$term->name] = l($term->name, $termPath);
}
print implode(', ', $links);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment