Introduction
Form Keybinds allows module developers to bind keypress events to form API
elements in custom forms.
Requirements
This module requires the following modules:
- Libraries API (https://drupal.org/project/libraries)
This module also requires the following third party libraries:
- Mousetrap (https://github.com/ccampbell/mousetrap)
Installation
- Install as you would normally install a contributed Drupal module. See:
https://drupal.org/documentation/install/modules-themes/modules-7
for further information. - Download the Mousetrap JavaScript library and place the mousetrap.js file
in sites/all/libraries/mousetrap.
Configuration
To utilize keybinds on your button or submit elements, you just supply a #key_binds key in your element's definition array. The value of this key is an array of keyboard keys that can be pressed to trigger the element's click/submit action. Please refer to the Mousetrap documentation for allowed values: https://craig.is/killing/mice.
Example:
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
'#key_binds' => array('shift+1', 'ctrl+1'),
);
Project information
- Module categories: Developer Tools
- 4 sites report using this module
- Created by Scott Robertson on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
Development version: 7.x-1.x-dev updated 26 Feb 2016 at 22:34 UTC