I have read all the documentation for the Views module and have even done some poking around the codebase, but for the life of me, can't figure out how to do this:
I have a module which creates albums of images. I have created an AJAX mechanism for sorting the images within album and a callback that saves the node id and order id of the images once they've been moved. Unfortunately, I can't figure out how to use that order table to order the images upon presenting the view of the album. I've added a hook_views_tables function (see below) and have tried to programatically use $view->sort (see below) to modify the query that gets built as part of views_build_view. Unfortunately, the query that view builds doesn't join the order table with the nodes table.
Why not? What am I missing? If I look in the view tables, nothing is saved there? I assume that's a symptom of my follow.
function acidfree_views_tables() {
$table = array(
'name' => 'acidfree_order',
'join' => array(
'left' => array(
'table' => 'node',
'field' => 'nid'
),
'right' => array(
'field' => 'nid'
)
)
);
$tables['acidfree_order'] = $table;
return $tables;
}
$view->sort[0] = array(
'vid' => $view->vid,