You are here

function sgrid_views_pre_render in Sortable Grid Views Plugin 7

Same name and namespace in other branches
  1. 6 sgrid.views.inc \sgrid_views_pre_render()

File

./sgrid.views.inc, line 68
sgrid.views.inc Views include file for Sortable Grid module

Code

function sgrid_views_pre_render(&$view) {

  // If the style of the current display is ours, we need our save button
  if ($view->style_plugin->definition['handler'] == 'views_plugin_style_sgrid') {
    if (user_access('sort Sortable Grid Views')) {
      $view->attachment_after .= "<button id='sgrid-button-save' value='" . t('Save') . "' />Save</button><button id='sgrid-button-reset' value='Reset Order' /> " . t('Reset Order') . "</button><div id='sgrid-mess'></div>";
    }

    // We also need to add our sortable class to the view
    $view->display_handler
      ->set_option('css_class', 'sortable');
  }
}