I'd like to make a patch for the D6 version of KML module so it supports views 2.
What is required is a feed of nodes. The feed will hold placemarks and the text for those placemarks should be defined using the row plugin. Ie. should be just a select number of fields, or the node (teaser or full). If fields are chosen then clearly a location field should be in there and it should be able to be hidden from display (as you can exclude various table columns with that option).
After having looked at the code and plugins and what doco I could find for a number of hours though, am pretty stumped as to how this is all fit together. Forgive this question, but there seems to be very little guidance for developers here :(
I kindof get somewhere but then seem to be lacking the quiet a few pieces of the puzzle to make this work. Here's what I've managed:
In kml.module:
<?php
function kml_views_api() {
return array(
'api' => 2,
'path' => drupal_get_path('module', 'kml'),
);
}
?>In kml.views.inc:
<?php
function kml_views_plugins() {
return array(
'module' => 'kml',
'style' => array(
'kml' => array(
'title' => t('KML Feed'),
'help' => t('Generates an KML feed from a view.'),
'handler' => 'kml_plugin_display_kml',
'theme' => 'kml_view_kml',
'uses row plugin' => TRUE, # How do I tell it that I'd like to select nodes or fields?
'type' => 'feed',
),
),
);
}
?>In kml_plugin_display_kml.inc:
<?php
class kml_plugin_display_kml extends views_plugin_style {
function validate() {
# When row type is 'fields' here we'll need to check that a location field is chosen
}
function render() {
# This is where I'll put the stuff to generate the KML (XML)
# I assume that their will be a list of full nodes or just the chosen fields to work with
# depending on the row plugin option
}
}
?>Has anyone got any clues on this? Am I heading in the right direction or completely off track?
Thanks in advance.
