public function sweaver_plugin_kb::sweaver_form_css_js in Sweaver 7
Same name and namespace in other branches
- 6 plugins/sweaver_plugin_kb/sweaver_plugin_kb.inc \sweaver_plugin_kb::sweaver_form_css_js()
Frontend css and js.
Overrides sweaver_plugin::sweaver_form_css_js
File
- plugins/
sweaver_plugin_kb/ sweaver_plugin_kb.inc, line 38 - Key bindings plugin.
Class
- sweaver_plugin_kb
- @file Key bindings plugin.
Code
public function sweaver_form_css_js(&$inline_settings) {
drupal_add_js(drupal_get_path('module', 'sweaver') . '/plugins/sweaver_plugin_kb/jquery.hotkeys.js');
drupal_add_js(drupal_get_path('module', 'sweaver') . '/plugins/sweaver_plugin_kb/sweaver_plugin_kb.js');
$bindings = $this
->sweaver_kb_bindings();
$binding_options = $this
->sweaver_kb_binding_options();
foreach ($bindings as $key => $value) {
// Do not add when a certain variable isn't set. (eg delete tab)
if (isset($value['variable']) && !variable_get($value['variable'], FALSE)) {
continue;
}
// Get keyboard key. Make sure it's not empty.
$keyboard_key = variable_get('sweaver_plugin_kb_' . $key, $value['default']);
if (!empty($keyboard_key)) {
$inline_settings['sweaver']['kb'][$key] = array(
'kb_code' => $keyboard_key,
'kb_button' => $binding_options[$keyboard_key],
'element' => isset($value['element']) ? $value['element'] : '',
'page_callback' => isset($value['page_callback']) ? $value['page_callback'] : '',
'message' => isset($value['message']) ? $value['message'] : '',
);
}
}
}