You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TIP: If you are working with an existing add-on, we recommend you start with [Modernizing add-ons](development/modernizing-existing-add-ons.md)
19
19
20
-
1. Create a `jump.[addon_name].php` file in your add-on folder
20
+
## Creating your add-on jump file.
21
+
Jumps are created via the CLI by using the `make:jump` command.
21
22
22
-
2. Your jump file MUST have the following:
23
+
```
24
+
php eecli.php make:jump
25
+
Let's create an add-on Jump File!
26
+
What add-on is the Jumps file being added to? (amazing_add_on, cron): [amazing_add_on]
27
+
Building Add-on Jumps file now.
28
+
Jumps file successfully created! Please note: You may need to clear your browser cache before you can see the new jump menu items
29
+
30
+
```
31
+
32
+
Follow the prompts to add a jump file to your add-on.
33
+
This will create a `jump.amazing_add_on.php` file in your add-on.
34
+
35
+
```
36
+
amazing_add_on
37
+
┣ jump.amazing_add_on.php
38
+
┗ ...
39
+
```
40
+
41
+
Please note, your jump file will contain of the following:
23
42
24
43
use ExpressionEngine\Service\JumpMenu\AbstractJumpMenu;
25
44
26
45
class [AddonName]_jump extends AbstractJumpMenu
27
46
{
28
47
29
-
protected static $items = [];
48
+
protected static $items = array(
49
+
'commandArrayTitle' => array(
50
+
'icon' => 'fa-file',
51
+
'command' => 'few lowercase words to be fuzzy-matched in jump menu',
52
+
'command_title' => 'Displayed <b>command title upon match from above</b>',
53
+
'dynamic' => false,
54
+
'requires_keyword' => false,
55
+
'target' => 'See Below. Behavior changes based on dynamic element above'
56
+
));
30
57
31
-
3. Add commands for your custom items.
32
-
Item commands are comprised of the following:
58
+
To Add Jump Menu commands to your add-on, you simply add array elements to the `$items` array in the example generated
33
59
34
-
-`[commandTitle]`_(string)_ Unique command title used as key in global jumps array. Will be prefixed with `[addonName]:` so a command title in Assets of `editS3Source` will be `Assets:editS3Source`
60
+
The array of a Jump Menu command is comprised of the following keys:
61
+
62
+
-`commandArrayTitle`_(string)_ Unique command title used as key in global jumps array. Will be prefixed with the add-ons name so a command title in the add-on AmazingAddOn of `processData` will be `AmazingAddon:processData`
-`command_title`_(string)_ Human-readable command title, shows up in results
64
+
-`command`_(string)_ lowercase string to be fuzzy-matched when user is typing in jump menu: “edit external source”
65
+
-`command_title`_(string)_Language file array key for Human-readable command title, shows up in results if fuzzy-matched. *Please note, this should be in your Lang file.
38
66
39
67
NOTE: Style Note: We use bold, italics, and brackets to denote keywords and actions to the user and urge you to use keep your commands in line with this style:
-`dynamic`_(bool)_ default: false, whether your command has secondary results
70
+
71
+
72
+
-`dynamic`_(bool)_ default: false, sets whether your command has secondary options in the jump menu
43
73
-`requires_keyword`_(bool)_ default: false, Used in conjunction with `dynamic`. Whether your command requires additional keywords to return results or not. An example of a `false` would be returning a list of channels. An example of `true` would be returning entries where you don’t want to prematurely return them before the user enters something to filter by.
44
-
-`target` (string)
74
+
-`target` (string) Can NOT be to an external link
45
75
- If `dynamic` == true: method name in your add-on’s jump file that will be called. Will be passed an array of search keywords.
46
76
- If `dynamic` == false: method name to redirect the user to in your add-on (ex: settings/license)
47
77
48
78
NOTE: This is currently hard-coded to `addons/settings/[addon_name]/X` but will most likely be changed to allow any CP URL path.
49
79
80
+
In addition to the required array elements above. There are also the following array element that is optional.
81
+
```
82
+
'permission' => 'ban_users'
83
+
84
+
```
85
+
-`permission`_(string)_ ExpressionEngine Role permissions that has to be matched for a user to see this jump menu command.
0 commit comments