Description
Filter the available keyboard shortcuts. Can be used to add or remove keyboard shortcuts for use within Gravity Forms.
Usage
Filter available shortcuts.
add_filter( 'gravityhopper-ks/keyboard_shortcuts', 'my_custom_callback' );
Parameters
shortcuts : array
Shortcuts which are loaded for use in Gravity Forms. Default is set to a multi-dimensional array of shortcuts defined in the module. Array items are structured as follows:
$shortcuts['CATEGORY']['TYPE']['SLUG'] = [
'keys' => '[KEYBINDING]',
'function' => '[JAVASCRIPT]',
'description' => '[DESCRIPTION]',
'priority' => [INT]
];
Examples
Add keyboard shortcut /
to focus search on form & entry list pages
add_filter( 'gravityhopper-ks/keyboard_shortcuts', function( $shortcuts ) {
if ( GFForms::get_page() == 'form_list' || GFForms::get_page() == 'entry_list' ) {
$shortcuts['Gravity Forms']['List Actions']['focus_search'] = [
'keys' => '/',
'function' => '$(`#form-search-input,input.gform-filter-value`).focus(); return false;',
'description' => 'Focus Search',
'priority' => 8
];
}
return $shortcuts;
} );