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/cli/creating-a-command.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,8 @@ The ExpressionEngine [Command Line Inferface (CLI)](/cli/intro.md) makes it simp
7
7
8
8
You can also build your own commands that will enable users to interact with your add-on or do other things inside of ExpressionEngine. Commands are created to live within add-ons, and are registered as part of the add-on process.
9
9
10
+
NOTE:Before adding a custom CLI Command to your add-on, you need to already have an add-on in place. See [Building An Add-On: Getting Started](development/addon-development-overview.md#getting-started) for how to generate the starter files for your add-on.
11
+
10
12
## Generate Our Add-on
11
13
We add custom commands to the CLI when our add-on is installed by using the CLI.
Copy file name to clipboardExpand all lines: docs/development/actions.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,8 @@
14
14
## Overview
15
15
Actions in ExpressionEngine are URL endpoints that are reached with the `ACT` query parameter. An example of this might be `http://myamazingsite.com/?ACT=43` where 43 is the ID given to an action registered in the `exp_actions` database table. These actions are tied to methods in an add-on which can be used to accept input from forms or run some sort of other functionality defined in the add-on.
16
16
17
+
NOTE:Before adding an action to your add-on, you need to already have an add-on in place. See [Building An Add-On: Getting Started](development/addon-development-overview.md#getting-started) for how to generate the starter files for your add-on.
18
+
17
19
## How To Build An Amazing Action?
18
20
To generate an action we use the CLI to add the action to our existing add-on named "Amazing Add-on".
Copy file name to clipboardExpand all lines: docs/development/custom-template-tags.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,8 @@ TIP:If you are unfamiliar with Template Tags be sure to read the docs on [Expres
21
21
22
22
Creating your own custom template tags allows you to display dynamic data from your add-on anywhere you want, in any template.
23
23
24
+
NOTE:Before adding a template tag to your add-on, you need to already have an add-on in place. See [Building An Add-On: Getting Started](development/addon-development-overview.md#getting-started) for how to generate the starter files for your add-on.
25
+
24
26
## Creating Template Tags
25
27
Tags are created via the CLI by using the `make:template-tag` command.
Copy file name to clipboardExpand all lines: docs/development/extensions.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,8 @@ lang: php
19
19
20
20
Within ExpressionEngine are what is known as "hooks"; little snippets of code in over 100 strategic places that allow the calling of third-party scripts that can rewrite and modify the inner workings of the program. By hooking into the core, you can do things like modify an entire Control Panel page, add/remove functionality, and modify the appearance of certain page elements. Hooks enable third party developers to modify aspects of ExpressionEngine without hacking the core.
21
21
22
+
NOTE:Before adding an extension hook to your add-on, you need to already have an add-on in place. See [Building An Add-On: Getting Started](development/addon-development-overview.md#getting-started) for how to generate the starter files for your add-on.
23
+
22
24
## Creating Our Extension Files
23
25
24
26
We can give our add-on the ability to hook into the core of ExpressionEngine by using the CLI:
Copy file name to clipboardExpand all lines: docs/development/fieldtypes/example.md
+38-11Lines changed: 38 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,9 +17,34 @@ The snippets below were truncated for clarity. The full example fieldtype can be
17
17
18
18
[TOC]
19
19
20
-
## Installation
21
-
22
-
The google maps fieldtype is going to have 3 global settings. Latitude, longitude, and zoom. These will determine what the default map looks like. By returning an array from within install we can provide a default set of global settings.
20
+
## Generate Fieldtype File
21
+
Start by generating a custom fieldtype for your add-on using the `make:fieldtype` command.
22
+
23
+
```
24
+
$ php system/ee/eecli.php make:fieldtype
25
+
Let's implement a fieldtype!
26
+
What is the fieldtype name? Amazing Fieldtype
27
+
What add-on is the fieldtype being added to? [amazing_add_on]: amazing_add_on
28
+
Building fieldype.
29
+
Fieldtype created successfully!
30
+
```
31
+
32
+
This will create a `ft.amazing__fieldtype.php` in your add-on's folder.
33
+
34
+
We'll now update the methods found within our fieldtype's class to provide our functionality:
35
+
-`function install()`
36
+
-`function display_global_settings()`
37
+
-`function save_global_settings()`
38
+
-`function display_settings()`
39
+
-`function save_settings()`
40
+
-`function display_field()`
41
+
-`function replace_tag()`
42
+
-`function replace_latitude()`
43
+
-`function replace_tag_catchall()`
44
+
45
+
## Installation - `install()`
46
+
47
+
The google maps fieldtype is going to have 3 global settings. Latitude, longitude, and zoom. These will determine what the default map looks like. By returning an array from within our `install()` method we can provide a default set of global settings.
23
48
24
49
function install()
25
50
{
@@ -35,7 +60,7 @@ The google maps fieldtype is going to have 3 global settings. Latitude, longitud
35
60
36
61
The installation method for this fieldtype does not create any additional tables, so no cleanup work needs to be done. The default `uninstall()` method provided by the EE_Fieldtype parent class will suffice. Most fieldtype methods have sensible defaults to help reduce duplicate code.
37
62
38
-
## Global Settings
63
+
## Global - `display_global_settings()`
39
64
40
65
The installer sets the default global settings, but currently there is no way to change these from the control panel. We can use the `display_global_settings()` method to return the contents of the settings form. Having this method also enables the global settings link on the overview page.
41
66
@@ -50,9 +75,9 @@ The installer sets the default global settings, but currently there is no way to
50
75
return $form;
51
76
}
52
77
53
-
Manually entering longitudes and latitudes is inconvenient so the final method in the example download also adds some javascript to let the user choose from a map.
78
+
Manually entering longitudes and latitudes is inconvenient so the final method in the example download also adds some JavaScript to let the user choose from a map.
54
79
55
-
## Saving Global Settings
80
+
## Saving Global Settings - `save_global_settings()`
56
81
57
82
In most instances saving the global settings is as easy as storing the `$_POST` array. Remember to include existing global settings if not everything can be changed.
58
83
@@ -61,7 +86,7 @@ In most instances saving the global settings is as easy as storing the `$_POST`
61
86
return array_merge($this->settings, $_POST);
62
87
}
63
88
64
-
## Individual Settings
89
+
## Individual Settings - `display_settings()`
65
90
66
91
The default map may not always be the desired choice for each map field, so on the regular settings page it will display a similar configuration screen. We will use the familiar [Shared Form View](development/shared-form-view.md) format to display our settings.
67
92
@@ -127,7 +152,7 @@ The default map may not always be the desired choice for each map field, so on t
127
152
));
128
153
}
129
154
130
-
## Saving Individual Settings
155
+
## Saving Individual Settings - `save_settings()`
131
156
132
157
Saving individual field settings works largely the same as saving global settings. Keep be aware that they are later merged with global settings, so they can override a global setting.
133
158
@@ -142,7 +167,7 @@ If your fieldtype needs a wide style on the publish form, like Grid or a Textare
142
167
);
143
168
}
144
169
145
-
## Displaying the Field (Publish Page)
170
+
## Displaying the Field On the Publish Page - `display_field()`
146
171
147
172
With all the settings set up, it can now be displayed on the publish screen. A key factor when you get to this stage is to decide in what format the data should be stored. Since all three available values in this case are numbers, this field will store them separated by pipes (`lang|lat|zoom`).
148
173
@@ -173,9 +198,9 @@ With all the settings set up, it can now be displayed on the publish screen. A k
Finally, the field needs a frontend display. For google maps this will almost exclusively be javascript.
203
+
Finally, the field needs a frontend display. For google maps this will almost exclusively be JavaScript.
179
204
180
205
function replace_tag($data, $params = array(), $tagdata = FALSE)
181
206
{
@@ -193,6 +218,8 @@ Finally, the field needs a frontend display. For google maps this will almost ex
193
218
194
219
Along with parameters a field can also provide tag modifiers to change its output. In the template these are called by adding a colon to the fieldname, followed by the modifier name. For example: `{myfield:latitude}`. The advantage that field modifiers have over parameters is that they can be used in conditionals.
195
220
221
+
These methods are not created by the CLI and need to be added as needed to your fieldtype's class.
222
+
196
223
Parsing the modifiers is identical to using the regular `replace_tag()` function. The method name must start with `replace_` followed by the modifier name.
197
224
198
225
function replace_latitude($data, $params = array(), $tagdata = FALSE)
Copy file name to clipboardExpand all lines: docs/development/fieldtypes/fieldtypes.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,10 +15,14 @@ lang: php
15
15
16
16
[TOC]
17
17
18
+
## Overview
19
+
ExpressionEngine ships with a range of fieldtypes already in place. However, perhaps you want to had your fieldtype that executes functionality differently than the fields that ship with ExpressionEngine. If so, then read below for how to create your own custom fieldtype.
20
+
18
21
TIP: For an overview of what a Fieldtype is, read the [Fieldtype Overview docs](/fieldtypes/overview.md).
19
22
23
+
NOTE:Before adding a fieldtype to your add-on, you need to already have an add-on in place. See [Building An Add-On: Getting Started](development/addon-development-overview.md#getting-started) for how to generate the starter files for your add-on.
20
24
21
-
## Generating A Custom Fieldtype
25
+
## Creating A Custom Fieldtype
22
26
23
27
Adding a custom fieldtype to your add-on is easy with the `make:fieldtype` command.
24
28
@@ -40,7 +44,7 @@ amazing_add_on
40
44
┗ ...
41
45
```
42
46
43
-
## Basic File Structure
47
+
## Basic Fieldtype File Structure
44
48
45
49
All fieldtypes must inherit from the `EE_Fieldtype` base class and they must provide an `$info` array with a name and version number.
Copy file name to clipboardExpand all lines: docs/development/modules.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
---
1
+
0---
2
2
lang: php
3
3
---
4
4
@@ -15,10 +15,13 @@ lang: php
15
15
16
16
[TOC=2-3]
17
17
18
+
## Overview
18
19
If you have ever used some of the add-ons that ship with ExpressionEngine such as [Block and Allow](/add-ons/blocklist.md) or [Pro Search](/add-ons/pro-search/overview.md), you will notice those add-ons have settings and configuration pages associated with them in the Control Panel. You add this functionality to your add-on using Control Panel Routes, also known as `Mcp` files. Whenever you add a Control Panel Route to your add-on using the CLI, an `Mcp` and `views` folder is automatically created for you, opening the door to creating your own Control Panel settings and pages.
19
20
20
21
NOTE:**NOTE:** Control Pages are what is rendered in the browser when visiting your add-on in the Add-on Manager. Control Panel Routes are what we had to our add-on that tells ExpressionEngine to render the pages. Think of it as we add a route to create a page.
21
22
23
+
NOTE:Before adding a Control Panel route to your add-on, you need to already have an add-on in place. See [Building An Add-On: Getting Started](development/addon-development-overview.md#getting-started) for how to generate the starter files for your add-on.
24
+
22
25
## Generate Your Route
23
26
24
27
If your add-on doesn't already have the required `Mcp` and `views` files, you can add a route to your add-on using the `make:mcp-route` command in the CLI.
Copy file name to clipboardExpand all lines: docs/development/prolets.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,8 @@ Prolets are add-on components that live in the [Dock](/advanced-usage/front-end/
18
18
Here is an example of the add-on SEEO's prolet, which easily allows editors to edit SEO data for the entry they are currently viewing:
19
19

20
20
21
+
NOTE:Before adding a Prolet to your add-on, you need to already have an add-on in place. See [Building An Add-On: Getting Started](development/addon-development-overview.md#getting-started) for how to generate the starter files for your add-on.
22
+
21
23
## Creating A Prolet
22
24
23
25
Creating a Prolet is straightforward using the `make:prolet` command in the CLI.
Copy file name to clipboardExpand all lines: docs/development/tab-files.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,8 @@ Add-ons can also add tabs which are visible on in [Publish Layouts](control-pane
23
23
Here is an example of the publish layout's tab for the Structure add-on:
24
24

25
25
26
+
NOTE:Before adding a tab to your add-on, you need to already have an add-on in place. See [Building An Add-On: Getting Started](development/addon-development-overview.md#getting-started) for how to generate the starter files for your add-on.
27
+
26
28
## Creating The Tab File
27
29
Tab files are not currently able to be generated through the CLI, thus you will need to manually create the file `tab.[addon_name].php` in the root of your add-on's folder.
Copy file name to clipboardExpand all lines: docs/development/widgets.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,8 @@
11
11
12
12
[TOC]
13
13
14
+
## Overview
15
+
14
16
Along with the basic widgets which will come native with ExpressionEngine, each third-party add-on can provide multiple widgets to show pertinent information to users.
15
17
16
18
Widgets which are shipped with add-ons can have `.html` or `.php` extension and have to be placed into `widgets` sub-directory of the add-on. They are then installed automatically when the add-on is installed or updated. When using the CLI to generate a widget, a PHP widget will be created.
@@ -20,6 +22,8 @@ TIP:Users can also create widgets using ExpressionEngine template manager withou
20
22
Here is an example of the Dashboard Widget shipped with the SEEO add-on:
NOTE:Before adding a Dashboard Widget to your add-on, you need to already have an add-on in place. See [Building An Add-On: Getting Started](development/addon-development-overview.md#getting-started) for how to generate the starter files for your add-on.
26
+
23
27
## PHP Widgets
24
28
25
29
In order for an add-on to provide dashboard widgets, it needs to contain `widgets` folder inside its main directory, which will contain the widget files.
0 commit comments