function views_megarow_views_pre_render in Views Megarow 7
Implements hook_views_pre_render(). Adds the CSS and JS needed for the functioning of the megarow.
File
- ./
views_megarow.module, line 188
Code
function views_megarow_views_pre_render(&$view) {
static $done = FALSE;
if ($view->plugin_name == 'table_megarows' && !$done) {
// Store if the row should be automatically closed when the form are
// processed.
$_SESSION['views_megarow']['autoclose'] = $view->style_plugin->options['autoclose'];
// Preserve initial destination URL query parameter.
$destination = drupal_get_destination();
$settings = array(
'ViewsMegarow' => array(
'loadingText' => $view->style_plugin->options['loading_text'],
'scrollEnabled' => $view->style_plugin->options['enable_scroll'],
'scrollPadding' => $view->style_plugin->options['scroll_padding'],
'close' => $view->style_plugin->options['close'],
'destination' => $destination['destination'],
// An image can also be used, like this:
//'close' => theme('image', array(
// 'path' => ctools_image_path('icon-close-window.png'),
// 'title' => t('Close window'),
// 'alt' => t('Close window'),
//)),
'throbber' => theme('image', array(
'path' => ctools_image_path('ajax-loader.gif', 'ctools_ajax_sample'),
'title' => $view->style_plugin->options['loading_text'],
'alt' => $view->style_plugin->options['loading_text'],
)),
),
);
drupal_add_js($settings, 'setting');
drupal_add_library('system', 'jquery.form');
drupal_add_library('system', 'drupal.progress');
drupal_add_library('system', 'drupal.ajax');
drupal_add_js(drupal_get_path('module', 'views_megarow') . "/views_megarow.js");
drupal_add_css(drupal_get_path('module', 'views_megarow') . "/views_megarow.css");
// Add the Views dropbutton CSS so that links provided by
// views_handler_field_megarow_links are styled properly.
// @todo Remove this once http://drupal.org/node/1557662 gets committed.
drupal_add_css(drupal_get_path('module', 'views') . '/css/views-admin.ctools.css');
drupal_add_css(drupal_get_path('module', 'views') . '/css/views-admin.seven.css');
$done = TRUE;
}
}