Skip to content

Commit 201636b

Browse files
committed
updating docs on how to make jump menu command for clarity
1 parent c13414f commit 201636b

File tree

1 file changed

+27
-10
lines changed

1 file changed

+27
-10
lines changed

docs/development/jump-menu.md

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,50 @@ Add-ons can easily add custom items for the Jump Menu.
1717

1818
NOTE: Sample File: https://gist.github.com/obfuscode/77d0135970c9ce8bc84139c127507bb1
1919

20-
1. Create a `jump.[addon_name].php` file in your add-on folder
20+
Create a `jump.[addon_name].php` file in your add-on folder
2121

22-
2. Your jump file MUST have the following:
22+
Your jump file MUST have the following:
2323

2424
use ExpressionEngine\Service\JumpMenu\AbstractJumpMenu;
2525

2626
class [AddonName]_jump extends AbstractJumpMenu
2727
{
2828

29-
protected static $items = [];
29+
protected static $items = array(
30+
'commandArrayTitle' => array(
31+
'icon' => 'fa-file',
32+
'command' => 'few lowercase words to be fuzzy-matched in jump menu',
33+
'command_title' => 'Displayed <b>command title upon match from above</b>',
34+
'dynamic' => false,
35+
'requires_keyword' => false,
36+
'target' => 'See Below. Behavior changes based on dynamic element above'
37+
));
3038

31-
3. Add commands for your custom items.
32-
Item commands are comprised of the following:
39+
To Add Jump Menu commands to your add-on, you simply add array elemnts to the $items array in the example above
3340

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`
41+
The array of a Jump Menu command is comprised of the following keys:
42+
43+
- `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 Assets of `editS3Source` will be `Assets:editS3Source`
3544
- `icon` _(string)_ FontAwesome format: `fa-file`
36-
- `command` )(string)_ lowercase fuzzy-matched search text: `edit external source`
37-
- `command_title` _(string)_ Human-readable command title, shows up in results
45+
- `command` )_(string)_ lowercase string to be fuzzy-matched when user is typing in jump menu: “edit external source
46+
- `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.
3847

3948
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:
4049
“Edit &lt;b&gt;Your Object&lt;/b&gt; titled &lt;i&gt;[secondary keywords]&lt;/i&gt;
4150
“Edit Author titled [name]
42-
- `dynamic` _(bool)_ default: false, whether your command has secondary results
51+
52+
53+
- `dynamic` _(bool)_ default: false, sets whether your command has secondary options in the jump menu
4354
- `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)
55+
- `target` (string) Can NOT be to an external link
4556
- If `dynamic` == true: method name in your add-on’s jump file that will be called. Will be passed an array of search keywords.
4657
- If `dynamic` == false: method name to redirect the user to in your add-on (ex: settings/license)
4758

4859
NOTE: This is currently hard-coded to `addons/settings/[addon_name]/X` but will most likely be changed to allow any CP URL path.
4960

61+
In addition to the required array elements above. There are also the following array element that is optional.
62+
```
63+
'permission' => 'ban_users'
64+
65+
```
66+
- `permission` _(string)_ ExpressionEngine Role permissions that has to be matched for a user to see this jump menu command.

0 commit comments

Comments
 (0)