You are here

function xmlsitemap_taxonomy_create_link in XML sitemap 6.2

Same name and namespace in other branches
  1. 7.2 xmlsitemap_taxonomy/xmlsitemap_taxonomy.module \xmlsitemap_taxonomy_create_link()

Create a sitemap link from a taxonomy term.

Parameters

$term: A taxonomy term object.

Return value

An array representing a sitemap link.

3 calls to xmlsitemap_taxonomy_create_link()
xmlsitemap_taxonomy_taxonomy in xmlsitemap_taxonomy/xmlsitemap_taxonomy.module
Implements hook_taxonomy().
xmlsitemap_taxonomy_update_6198 in xmlsitemap_taxonomy/xmlsitemap_taxonomy.install
Migrate 6.x-1.x taxonomy data.
xmlsitemap_taxonomy_xmlsitemap_process_taxonomy_term_links in xmlsitemap_taxonomy/xmlsitemap_taxonomy.module
Process taxonomy term sitemap links.

File

xmlsitemap_taxonomy/xmlsitemap_taxonomy.module, line 140

Code

function xmlsitemap_taxonomy_create_link(stdClass &$term) {
  if (!isset($term->xmlsitemap)) {
    $term->xmlsitemap = array();
    if ($term->tid && ($link = xmlsitemap_link_load('taxonomy_term', $term->tid))) {
      $term->xmlsitemap = $link;
    }
  }
  $settings = xmlsitemap_link_bundle_load('taxonomy_term', $term->vid);
  $uri = xmlsitemap_entity_uri('taxonomy_term', $term);
  $term->xmlsitemap += array(
    'id' => $term->tid,
    'type' => 'taxonomy_term',
    'subtype' => $term->vid,
    'status' => $settings['status'],
    'status_default' => $settings['status'],
    'status_override' => 0,
    'priority' => $settings['priority'],
    'priority_default' => $settings['priority'],
    'priority_override' => 0,
  );

  // The following values must always be checked because they are volatile.
  // @todo How can/should we check taxonomy term access?
  $term->xmlsitemap['loc'] = $uri['path'];
  $term->xmlsitemap['access'] = 1;
  $term->xmlsitemap['language'] = isset($term->language) ? $term->language : '';
  return $term->xmlsitemap;
}