I have a node type that references other nodes. When viewing node of Content Type A, I have set up a view that displays all references to nodes of Content Type B on a gmap.
This is the code from a template file that overrides the display of view_one; it calls the map in from another view.
<?php
$view = views_get_view('view_one');
$view->set_arguments(array($fields['nid']->raw));
$view->execute();
$contents = $view->result;
foreach($contents as $content) {
$nodes[] = $content->node_field_data_field_B_content_nid;
}
if (isset($nodes)) {
$args = implode(',' , $nodes);
$view = views_get_view('linked_map');
$view->set_display('map');
$view->set_arguments(array($args));
$view->execute();
$markup_map = $view->render($args);
}
else {
$markup_map = '';
}
?>
It displays beautifully. The only problem is I want to use numbered markers, so that the list is in the same order as the referenced nodes in the main view ("view_one"). Is there some way that I can either utilize a "sort" that won't rearrange the list, or write a custom sort that will preserve the existing order?
I am using the Views module version 7.x-3.1.