function theme_slickgrid_controls in Slickgrid 7
Same name and namespace in other branches
- 7.2 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()
File
- theme/
theme.inc, line 301
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>';
if ($view->style_plugin->options['add']) {
$output .= '<div class="slickgrid-control" id="slickgrid-add">' . ctools_modal_text_button('<span class="slickgrid-control-button enabled"></span>', SLICKGRID_CALLBACK_PATH . '/add/' . $view->style_plugin->options['add'] . '/' . $variables['view']->name . '/' . $variables['view']->current_display, t('Add'), 'ctools-modal-ctools-modal-slickgrid-scale') . '</div>';
}
// Add controls defined by our slickgrid module (undo, export, delete)
if ($view->style_plugin->options['undo']) {
drupal_add_js($path . '/js/controls/slickgrid.undo.js');
$output .= '<div class="slickgrid-control" id="slickgrid-undo"></div>';
}
if ($view->style_plugin->options['delete']) {
drupal_add_js($path . '/js/controls/slickgrid.delete.js');
$output .= '<div class="slickgrid-control" id="slickgrid-delete"></div>';
}
if (isset($view->style_plugin->options['export'])) {
drupal_add_js($path . '/js/controls/slickgrid.export.js');
$output .= '<div class="slickgrid-control" id="slickgrid-export"></div>';
}
if (isset($view->style_plugin->options['clone'])) {
drupal_add_js($path . '/js/controls/slickgrid.clone.js');
$output .= '<div class="slickgrid-control" id="slickgrid-clone"></div>';
}
return $output;
}