You are here

function theme_kml_feed in KML 6

Same name and namespace in other branches
  1. 5 kml.module \theme_kml_feed()

Views plugin that displays the KML feed for views

1 call to theme_kml_feed()
kml_interface in ./kml.module
Default callback

File

./kml.module, line 651
KML Module

Code

function theme_kml_feed($view, $nodes, $type) {
  if ($type == 'block') {
    return;
  }
  $attributes['title'] = t('%view_title', array(
    '%view_title' => $view->page_title,
  ));
  $attributes['description'] = t('%view_description', array(
    '%view_description' => $view->description,
  ));

  /* Get changed date for cache. */
  $max_changed = 0;
  $hash_list = array();
  foreach ($nodes as $node) {
    $hash_list[] = $node->nid;

    /* Get the changed for this node for cache */
    $changed = db_result(db_query("SELECT n.changed FROM {node} n WHERE n.nid = %d", $node->nid));
    if ($changed > $max_changed) {
      $max_changed = $changed;
    }
  }
  sort($hash_list);
  $cache_name = 'kml:view:' . $view->vid;
  $cid = $cache_name . ':' . md5(join('+', $hash_list));

  /* There's no need to check access because views does that for us */
  _kml_feed_check_cache($nodes, $attributes, $cid, $max_changed);
}