Exemplo n.º 1
0
/**
 * Get the path of the vsite which the vocab belong.
 *
 * @param $tid
 *  The term ID.
 *
 * @return
 *  The path of the vsite.
 */
function os_taxonomy_vsite_path($tid)
{
    $term = taxonomy_term_load($tid);
    $purls =& drupal_static(__FUNCTION__, array());
    if (in_array($term->vid, $purls)) {
        // We already found purl for this vocab. Return the purl from the static
        // cache.
        return $purls[$term->vid];
    }
    $relation = og_vocab_relation_get($term->vid);
    $vsite = vsite_get_vsite($relation->gid);
    $purls[$term->vid] = $vsite->group->purl;
    return $vsite->group->purl;
}
Exemplo n.º 2
0
 public static function getFileVsitePurl($fid)
 {
     // Get vid.
     $file = file_load($fid);
     $vid = $file->vid;
     // Get og_vocab relation.
     $relation = og_vocab_relation_get($vid);
     if (empty($relation)) {
         // Vocabulary is not related to a group.
         return '';
     }
     // Get vsite.
     return node_load($relation->gid)->purl;
 }