function _draggableviews_load_order_view in DraggableViews 7.2
Load and/or built the order view with the correct view display.
Parameters
$view: The view object
Return value
The view object with the sort display
3 calls to _draggableviews_load_order_view()
- draggableviews_join_handler::build_join in views/
draggableviews_join_handler.inc - Build the SQL for the join this object represents.
- draggableviews_preprocess_views_view_table in ./
draggableviews.module - Implements hook_preprocess_views_view_table().
- _draggableviews_get_order_path in ./
draggableviews.module - Get the path to the order view.
File
- ./
draggableviews.module, line 448
Code
function _draggableviews_load_order_view($view, $include_self = TRUE) {
if ($order_view_name_display = _draggableviews_get_order_view_display($view, $include_self)) {
if ($order_view_name_display == 'self' && $include_self) {
$order_view = $view;
}
else {
list($order_view_name, $order_view_display) = explode(':', $order_view_name_display);
if ($order_view_name == $view->name) {
if ($order_view_display == $view->current_display) {
$order_view = $view;
}
else {
// The current $view object does not have the information of the
// display view that sorts it. An example would be the draggableviews
// field, which is only in the sort order display.
$order_view = views_get_view($order_view_name);
// Error gets thrown if the order_view_display has not been saved yet.
if (!isset($order_view)) {
// TODO: Error message can get repeated 3-4 times. Should only happen once.
drupal_set_message(t('The order view is unavailable. Try saving or re-saving the view'), 'error');
return;
}
$order_view
->set_display($order_view_display);
$order_view
->init_handlers();
}
}
else {
// Need to get the order view, as order is not part of this one.
$order_view = views_get_view($order_view_name);
// Checks if view/display exists and user have access.
if ($order_view && $order_view
->access($order_view_display)) {
$order_view
->set_display($order_view_display);
$order_view
->init_handlers();
}
}
}
return $order_view;
}
}