You are here

function taxonomy_server_entity_prepare_view in Taxonomy import/export via XML 7

Insert a reference to our pure-xml data whenver the user-HTML page is diplayed for a term

See also

hook_entity_prepare_view()

File

taxonomy_server/taxonomy_server.module, line 336
Extends taxonomy_xml to publish downloadable or queriable taxonomy vocabularies and terms. Extends the Drupal URLs to make vocabulary information available under /taxonomy/vocabulary and /taxonomy/vocabulary/{vid}.

Code

function taxonomy_server_entity_prepare_view($entities, $entity_type) {
  switch ($entity_type) {
    case "taxonomy_term":
      foreach ($entities as $term) {
        $rdf_uri = url('taxonomy/term/' . $term->tid . '/rdf', array(
          'absolute' => TRUE,
        ));
        drupal_add_html_head_link(array(
          'rel' => 'alternate',
          'type' => 'application/rdf+xml',
          'title' => $term->name,
          'href' => $rdf_uri,
        ));
      }
  }
}