Skip to content

Commit c0a092b

Browse files
authored
Merge pull request #586 from ExpressionEngine/7.dev
Pushing Jump Menu Docs Live
2 parents b2a3030 + d5a941a commit c0a092b

File tree

2 files changed

+50
-13
lines changed

2 files changed

+50
-13
lines changed

docs/development/jump-menu.md

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,71 @@ lang: ee
1515

1616
Add-ons can easily add custom items for the Jump Menu.
1717

18-
NOTE: Sample File: https://gist.github.com/obfuscode/77d0135970c9ce8bc84139c127507bb1
18+
TIP: If you are working with an existing add-on, we recommend you start with [Modernizing add-ons](development/modernizing-existing-add-ons.md)
1919

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.
2122

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:
2342

2443
use ExpressionEngine\Service\JumpMenu\AbstractJumpMenu;
2544

2645
class [AddonName]_jump extends AbstractJumpMenu
2746
{
2847

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+
));
3057

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
3359

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`
3563
- `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
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.
3866

3967
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:
4068
“Edit &lt;b&gt;Your Object&lt;/b&gt; titled &lt;i&gt;[secondary keywords]&lt;/i&gt;
4169
“Edit Author titled [name]
42-
- `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
4373
- `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
4575
- If `dynamic` == true: method name in your add-on’s jump file that will be called. Will be passed an array of search keywords.
4676
- If `dynamic` == false: method name to redirect the user to in your add-on (ex: settings/license)
4777

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

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.

docs/toc_sections/_advanced_usage_toc.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@
158158
href: cli/displaying-output.md
159159
- name: Adding Template Tags
160160
href: development/custom-template-tags.md
161+
- name: Adding Jump Menu Items
162+
href: development/jump-menu.md
161163
- name: Using Language Files
162164
href: development/add-on-language-files.md
163165
- name: Adding Publish Form Tabs
@@ -166,6 +168,7 @@
166168
href: development/prolets.md
167169
- name: Adding Dashboard Widgets
168170
href: development/widgets.md
171+
169172
#- name: REMOVE - Adding Text Formatting Options
170173
# href: development/text-formatting.md
171174
- name: Modernizing add-ons
@@ -308,8 +311,6 @@
308311
- name: Wiki Module
309312
href: development/extension-hooks/module/wiki.md
310313

311-
- name: Jump Menu
312-
href: development/jump-menu.md
313314
- name: Learn About the Core
314315
href: development/architecture.md
315316
- name: Services

0 commit comments

Comments
 (0)