-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkonamicode.api.php
54 lines (49 loc) · 1.34 KB
/
konamicode.api.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* @file
* API for the Konami Code Drupal module
*/
/**
* Describes all the Konami Code actions available.
*
* @return
* An associative array where the key is the machine name of the Konami Code
* action, and the value is the human readable name of the action.
*/
function hook_konamicode() {
return array(
'redirect' => t('Redirect'),
);
}
/**
* Invoked when the selected Konami Code is used.
*
* Replace ACTION with the name of the Konami Code action.
*/
function hook_konamicode_ACTION() {
backdrop_add_js(backdrop_get_path('module', 'konamicode') . '/konamicode-redirect.js');
}
/**
* Provides all the actions for the given Konami Code.
*
* @return
* A form array. Note that you must use element names that are unique the
* given action as they will be used in a system settings form. This means
* that all the elements will end up as variables with the same names.
*/
function hook_konamicode_ACTION_settings() {
$form['konamicode_redirect_destination'] = array(
// ...
'#default_value' => variable_get('konamicode_redirect_destination', ''),
);
return $form;
}
/**
* JavaScript code in konamicode-redirect.js is as follows:
* Replace ACTION with the name of your action.
*
* Drupal.konamicode_ACTION = function() {
* window.location = 'http://bacolicio.us/' + window.location;
* };
*
*/