Keyboard Shortcuts

Terminology used

This guide will use certain terminology in an effort to make it easier to understand:

Very simple, but worth noting.

## Base Shortcuts

There are seven shortcut actions available in a base install of Bonfire of which two have shortcut keys assigned:

The two actions which have keys assigned are:

To view the Shortcuts which are active in your Bonfire installation click on the keyboard icon at the top right of the control panel.

## How to assign keys

You can assign shortcut keys to each of the actions available by simply visiting the Keyboard Shortcuts page under the Settings menu.

There you can choose the action in a dropdown list and assign keys.

Bonfire uses the Jwerty project to handle the shortcuts and you will find more examples of possible shortcut keys on the project site.

Note: Spaces are not allowed in your shortcut keys as this would break the javascript.

### How to add actions

The shortcut actions are managed in the application config file /bonfire/application/config/application.php in the ui.current_shortcuts array element.

The array contains an array “key” for the shortcut action, e.g. ‘delete’. The action itself contains a description and the action javascript.

/*
	Array containing the currently available shortcuts
	- these are output in the /ui/views/shortcut_keys file
*/
$config['ui.current_shortcuts'] = array(
	'form_save'      => array(
			'description' => 'Save any form in the admin area.',
			'action' => '$("input[name=submit]").click();return false;'
	),
	'create_new'     => array(
			'description' => 'Create a new record in the module.',
			'action' => 'document.location=$("a#create_new").attr("href");'
	),
	'select_all'     => array(
			'description' => 'Select all records in an index page.',
			'action' => '$("table input[type=checkbox]").click();return false;'
	),
	'delete'         => array(
			'description' => 'Delete the record(s).',
			'action' => '$("#delete-me.btn-danger").click();'
	),
	'goto_content'   => array(
			'description' => 'Jump to the Content context.',
			'action' => "document.location='/" . SITE_AREA . "/content';"
	),
	'goto_reports'   => array(
			'description' => 'Jump to the Reports context.',
			'action' => "document.location='/" . SITE_AREA . "/reports';"
	),
	'goto_settings'  => array(
			'description' => 'Jump to the Settings context.',
			'action' => "document.location='/" . SITE_AREA . "/settings';"
	),
);

You can add your own shortcut actions to this list by adding a new array element. It will then appear as a dropdown option on the Keyboard Shortcuts page under the Settings menu.

It works best when the HTML classes and ids are standardized.