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
Copy file name to clipboardExpand all lines: docs/development/addon-development-overview.md
+30-14Lines changed: 30 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,7 @@ Getting started making an add-on is incredibly easy with the CLI. To begin makin
38
38
$ php system/ee/eecli.php make:addon
39
39
Let's build your add-on!
40
40
What is the name of your add-on? Amazing Add-On
41
-
Add-on description? This add-on does amazing things!
41
+
Add-on description? [Amazing Add-on description] This add-on does amazing things!
42
42
Add-on version? [1.0.0]1.0.0
43
43
Add-on author? ExpressionEngine Developer
44
44
Add-on author URL? www.expressionengine.com
@@ -47,15 +47,10 @@ Your add-on has been created successfully!
47
47
48
48
```
49
49
50
-
This will create an add-on named Amazing Add-On in your `system/user/addons` folder with a file structure like below:
50
+
This will create an add-on named Amazing Add-On in your `system/user/addons` folder with a skeleton file structure like below:
51
51
52
52
```
53
53
amazing_add_on/
54
-
┣ Module/
55
-
┃ ┣ Actions/
56
-
┃ ┃ ┗ ExampleAction.php
57
-
┃ ┗ Tags/
58
-
┃ ┗ ExampleTag.php
59
54
┣ language/
60
55
┃ ┣ english/
61
56
┃ ┃ ┣ amazing_add_on_lang.php
@@ -64,7 +59,7 @@ amazing_add_on/
64
59
┗ upd.amazing_add_on.php
65
60
```
66
61
67
-
This is the starting point of an add-on and is enough to begin creating template tags, extension hooks, and much more! From here, you can add more functionality to your add-on depending on your needs.
62
+
At this point, your add-on can't really do anything other than be installed. However, from here, you can add more functionality to your add-on via the CLI depending on your needs.
68
63
69
64
Here's a list of functionality that can be added to your add-on and the corresponding CLI command if applicable:
70
65
@@ -96,6 +91,7 @@ amazing_add_on
96
91
┃ ┣ TemplatePostParse.php
97
92
┃ ┗ TypographyParseTypeEnd.php
98
93
┣ Mcp
94
+
┃ ┣ Sidebar.php
99
95
┃ ┣ Index.php
100
96
┃ ┗ Page2.php
101
97
┣ Module
@@ -172,31 +168,51 @@ Reference [Adding Prolets](development/prolets.md) for more information on addin
172
168
### The Add-on Icon File `icon.svg`
173
169
The add-on icon folder is used both in the Add-on Manager and in the Dock on the front-end to distinguish your add-on from others.
174
170
175
-
### `/Extensions`
171
+
### Extensions - `/Extensions`
176
172
When we tell the CLI that we want to create an extension, classes are automatically created in the `Extensions` folder along with the above mentioned `ext.[addon_name].php` file. Interacting with hooks allows us to extend ExpressionEngine's functionality, thus we refer to these as "extensions".
177
173
178
174
TIP: Reference the [Extensions](development/extensions.md) section of the docs for more information on using extensions in your add-on.
179
175
180
-
### `Module/Actions`
181
-
The `Module/Actions` folder stores all the business logic for any actions that we are adding to ExpressionEngine with our add-on. Each action will have a separate file and corresponding class created based on information provided in the `$actions` array in the `upd` file.
176
+
### Actions - `/Module/Actions`
177
+
The `Module/Actions` folder stores all the business logic for any actions that we are adding to ExpressionEngine with our add-on. Each action will have a separate file and corresponding class created based on information provided in the `$actions` array in the `upd` file.
178
+
Reference [Adding Actions](development/actions.md) for more information on creating URL endpoints (actions) with your add-on.
179
+
180
+
### Control Panel Pages - `/Mcp`
181
+
The `Mcp` folder contains all the Control Panel pages and sidebar we create for our add-on.
182
+
Reference [Adding Control Panel Pages](development/modules.md) for more information on adding Control Panel pages with your add-on.
182
183
183
184
### `Module/Tags`
184
-
The `Module/Tags` folder stores all the business logic for any template tags we create with our add-on.
185
+
The `Module/Tags` folder stores all the business logic for any template tags we create with our add-on.
186
+
Reference [Adding Template Tags](development/custom-template-tags.md) for more information on adding template tags with your add-on.
185
187
186
188
### `/views`
187
189
The `views` folder contains all of our Control Panel views which will be used to render our add-on's control panel pages.
188
190
189
191
### `/language`
190
-
The `language` folder contains all of our language files that will be used to display text on a page in whatever language is selected in the user’s account settings.
192
+
The `language` folder contains all of our language files that will be used to display text on a page in whatever language is selected in the user’s account settings.
193
+
Reference [Using Language Files](development/add-on-language-files.md) for more information on using language files with your add-on.
191
194
192
195
### `/database/migrations`
193
196
The `/database/migrations` folder holds all migrations that will be ran on installation or updating of our add-on. Using the CLI, migrations can also be ran independently.
194
197
195
198
### `Model`
196
-
The `Model` folder holds all models that we are creating with our add-on.
199
+
The `Model` folder holds all models that we are creating with our add-on.
200
+
Reference [Building Your Own Models](/development/services/model/building-your-own.md) for more information on creating your own models with your add-on.
197
201
198
202
### `widgets`
199
203
The `widgets` folder holds all dashboard widgets we create with our add-on.
204
+
Reference [Developing Dashboard Widgets](development/widgets.md) for more information on creating widgets with your add-on.
205
+
206
+
## Setting Default CLI Config Values
207
+
208
+
When creating an add-on via the CLI you will be asked for author and the author's URL. If you'd like to skip these questions when creating an add-on, you can set default values in your [config](/general/system-configuration-overrides.md#main-configuration-file) file like so:
In the past, add-ons were often categorized based on their functionality. We identified our add-on to ExpressionEngine as a fieldtype, extension, module, or plug-in. Thus there was never a straightforward process on structuring one add-on that contained all these categories in one.
Copy file name to clipboardExpand all lines: docs/development/fieldtypes/fieldtypes.md
+18-4Lines changed: 18 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,15 +24,25 @@ Adding a custom fieldtype to your add-on is easy with the `make:fieldtype` comma
24
24
25
25
```
26
26
$ php system/ee/eecli.php make:fieldtype
27
-
compatiblity
27
+
Let's implement a fieldtype!
28
+
What is the fieldtype name? Amazing Fieldtype
29
+
What add-on is the fieldtype being added to? [amazing_add_on]: amazing_add_on
30
+
Building fieldype.
31
+
Fieldtype created successfully!
28
32
```
29
33
30
-
Follow the prompts to complete the setup of your custom fieldtype.
34
+
This will create a `ft.[fieldtype_name].php` in your add-on's folder. In the example above, this creates a file named `ft.amazing__fieldtype.php`.
31
35
36
+
```
37
+
amazing_add_on
38
+
...
39
+
┣ ft.[fieldtype_name].php
40
+
┗ ...
41
+
```
32
42
33
43
## Basic File Structure
34
44
35
-
Once generated via the CLI a file named `ft.[addon_name].php` will created in your add-on's folder. All fieldtypes must inherit from the `EE_Fieldtype`.
45
+
All fieldtypes must inherit from the `EE_Fieldtype` base class and they must provide an `$info` array with a name and version number.
36
46
37
47
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
38
48
@@ -59,7 +69,7 @@ Once generated via the CLI a file named `ft.[addon_name].php` will created in yo
NOTE: **Note:**All add-ons are required to have an [addon.setup.php file](development/addon-setup-php-file.md). This is where Fieldtypes can declare their compatibility with other Fieldtypes, allowing a site builder to switch an existing field to another compatible type, e.g. _text_ can be switched to _email_ and vice-versa. Please see [Fieldtype Compatibility Options](development/addon-setup-php-file.md#fieldtypes) for more details.
72
+
NOTE: **Note:** Fieldtypes can declare their compatibility with other Fieldtypes in the `addon.setup.php` file, allowing a site admin to switch an existing field to another compatible type, e.g. _text_ can be switched to _email_ and vice-versa. Please see [Fieldtype Compatibility Options](development/addon-setup-php-file.md#fieldtypes) for more details.
63
73
64
74
NOTE: We also have [Example fieldtype with annotations](development/fieldtypes/example.md) for your reference.
65
75
@@ -558,3 +568,7 @@ Here are the usage details for this function:
558
568
A jQuery object of the field being affected by the current event is passed to the callback function.
559
569
560
570
NOTE: **Note:** Please refer to [Enhanced Fieldtype Features](development/fieldtypes/enhanced.md) page for advanced topics, such ad working with Live Preview, Entry Manager, Entry Cloning, File Picker and Conditional Fields.
571
+
572
+
## Do Something: Build A Fieldtype
573
+
574
+
For a complete fieldtype example see the [Google Maps Fieldtype example](/development/fieldtypes/example.md).
Copy file name to clipboardExpand all lines: docs/development/modules.md
+76-1Lines changed: 76 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -110,7 +110,82 @@ If you needed to add more levels to your breadcrumbs you can chain them together
110
110
This would add a breadcrumb that would look like `Add-Ons -> [Add-On Name] -> Settings -> Configuration`
111
111
112
112
### Sidebar
113
-
TBD
113
+
If your add-on has multiple Control Panel pages, a sidebar can be incredibly helpful for your users to easily navigate between pages. Sidebars can either be generated automatically or manually.
114
+
115
+
#### Automatically Generate Your Sidebar
116
+
We can use the `make:sidebar` CLI command to generate a sidebar file for us.
117
+
118
+
```
119
+
$ php system/ee/eecli.php make:sidebar
120
+
What add-on is the sidebar being added to? [amazing_add_on]: amazing_add_on
121
+
Building sidebar.
122
+
Sidebar created successfully!
123
+
```
124
+
125
+
This will create the file `Mcp/Sidebar.php` in your add-on's folder.
126
+
127
+
```
128
+
amazing_add_on
129
+
┣ Mcp/
130
+
┃ ┣ Sidebar.php
131
+
┗ ...
132
+
```
133
+
134
+
**Note:** An add-on can only have one sidebar file.
135
+
136
+
Inside of our `Sidebpar.php` file we'll have the following:
use ExpressionEngine\Service\Addon\Controllers\Mcp\AbstractSidebar;
144
+
145
+
class Sidebar extends AbstractSidebar
146
+
{
147
+
public $automatic = true;
148
+
149
+
/**
150
+
* @param false $id
151
+
* @return AbstractRoute
152
+
*/
153
+
public function process()
154
+
{
155
+
}
156
+
}
157
+
```
158
+
159
+
That's it! Our `Sidebar` class will scan our `Mcp` folder for all available Control Panel routes and automatically create respective entries in our sidebar. There's no need to add the sidebar to your Control Panel page as it will automatically be added when the page is rendered.
160
+
161
+
Example:
162
+
163
+
With an add-on folder like this:
164
+
165
+
```
166
+
amazing_add_on
167
+
┣ Mcp
168
+
┃ ┣ Configurations.php
169
+
┃ ┣ Settings.php
170
+
┃ ┣ Licenses.php
171
+
┃ ┣ Index.php
172
+
┃ ┗ Sidebar.php
173
+
┗ ...
174
+
```
175
+
176
+
Would produce a sidebar in the Control Panel like this:
You can take this a step further by adjusting the following properties in your `Mcp` files to adjust how sidebar items are displayed:
182
+
-**`protected $sidebar_title (string)`** - By default the sidebar link text is based on your route's name. This property will overwrite the text displayed for this route.
183
+
-**`protected $sidebar_icon (string)`** - The Font Awesome icon you wish to display next to the sidebar link for this route.
184
+
-**`protected $sidebar_is_folder (bool)`** -
185
+
-**`protected $sidebar_is_list (bool)`** -
186
+
-**`protected $exclude_from_sidebar (bool)`** - Exclude this route from the sidebar.
187
+
-**`protected $sidebar_divider_before (bool)`** - Inserts a divider in the sidebar before
0 commit comments