You are here

function theme_slickgrid_controls in Slickgrid 7.2

Same name and namespace in other branches
  1. 7 theme/theme.inc \theme_slickgrid_controls()

Theme function for the slickgrid control interface

Parameters

array $options:

array $columns:

array $view_name:

1 theme call to theme_slickgrid_controls()
slickgrid_preprocess_views_view_slickgrid in theme/theme.inc

File

theme/theme.inc, line 355

Code

function theme_slickgrid_controls($variables) {
  $view = $variables['view'];
  $path = drupal_get_path('module', 'slickgrid');
  drupal_add_css($path . '/css/slickgrid.controls.css');
  $library_path = libraries_get_path('slickgrid');
  $output = '';

  // Add controls defined by the slickgrid plugin (pager)
  if (isset($view->style_plugin->options['pager']) && $view->style_plugin->options['pager']) {
    drupal_add_js($library_path . '/controls/slick.pager.js');
    drupal_add_css($library_path . '/controls/slick.pager.css');
    $output .= '<div class="slickgrid-control" id="slickgrid-pager"></div>';
  }
  if (isset($view->style_plugin->options['grouping_field']) && !empty($view->style_plugin->options['grouping_field'])) {
    drupal_add_js($library_path . '/slick.groupitemmetadataprovider.js');
  }
  $output .= '<div id="slickgrid-status"></div>';

  // Add controls
  foreach (array(
    'undo',
    'delete',
    'export',
    'clone',
    'add',
  ) as $control) {
    $output .= theme('slickgrid_control__' . $control, array(
      'control' => $control,
      'view' => $view,
      'path' => $path,
    ));
  }
  return $output;
}