You are here

public function sweaver_plugin_kb::sweaver_menu_callback in Sweaver 6

Same name and namespace in other branches
  1. 7 plugins/sweaver_plugin_kb/sweaver_plugin_kb.inc \sweaver_plugin_kb::sweaver_menu_callback()

Keyboard bindings settings form.

Overrides sweaver_plugin::sweaver_menu_callback

File

plugins/sweaver_plugin_kb/sweaver_plugin_kb.inc, line 65
Key bindings plugin.

Class

sweaver_plugin_kb
@file Key bindings plugin.

Code

public function sweaver_menu_callback() {
  $form = array();
  $bindings = $this
    ->sweaver_kb_bindings();
  $binding_options_firstkey = drupal_map_assoc($this
    ->sweaver_kb_binding_firstkeys());
  $binding_options = drupal_map_assoc($this
    ->sweaver_kb_binding_options());
  $form['info'] = array(
    '#type' => 'markup',
    '#value' => t('Select keys for every event possible. Note, there is no validation when saving this form, so make sure every event has a unique key combination.'),
  );
  $form['sweaver_plugin_kb_firstkey'] = array(
    '#type' => 'select',
    '#title' => t('First key'),
    '#options' => $binding_options_firstkey,
    '#description' => t('Can be used for all events, except the close popup'),
    '#default_value' => variable_get('sweaver_plugin_kb_firstkey', ''),
  );
  foreach ($bindings as $key => $value) {
    $form['sweaver_plugin_kb_' . $key] = array(
      '#type' => 'select',
      '#options' => $binding_options,
      '#title' => $value['title'],
      '#default_value' => variable_get('sweaver_plugin_kb_' . $key, $value['default']),
    );
  }
  return system_settings_form($form);
}