function kml_format_folder in KML 5
Same name and namespace in other branches
- 6 kml.module \kml_format_folder()
Formats a KML Folder (based on format_rss_channel()).
Arbitrary elements may be added using the $args associative array.
1 call to kml_format_folder()
- _kml_format_feed in ./
kml.module - A generic function for generating KML (Keyhole Markup Language for Google Earth) feeds from a set of nodes.
File
- ./
kml.module, line 794 - KML Module
Code
function kml_format_folder($title, $description, $items, $args = array()) {
// arbitrary elements may be added using the $args associative array
$output = " <Folder>\n" . ' <name>' . check_plain($title) . "</name>\n" . ' <description>' . check_plain($description) . "</description>\n";
if ($args) {
// TODO: needs better way of structuring this data so we can embed elements and their attributes
foreach ($args as $key => $value) {
if (is_array($value)) {
if ($value['key']) {
$output .= ' <' . $value['key'];
if (is_array($value['attributes'])) {
$output .= drupal_attributes($value['attributes']);
}
if ($value['value']) {
$output .= '>' . $value['value'] . '</' . $value['key'] . ">\n";
}
else {
$output .= " />\n";
}
}
}
else {
$output .= ' <' . $key . '>' . check_plain($value) . "</{$key}>\n";
}
}
}
$output .= $items . " </Folder>\n";
return $output;
}