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
+2-17Lines changed: 2 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ You can also build your own commands that will enable users to interact with you
9
9
10
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
11
12
-
## Generate Our Add-on
12
+
## Creating An Amazing Command
13
13
We add custom commands to the CLI when our add-on is installed by using the CLI.
14
14
15
15
```
@@ -26,16 +26,6 @@ amazing_add_on
26
26
┃ ┣ Command[CommandName].php
27
27
```
28
28
29
-
## `addon.setup.php`
30
-
31
-
We see that the CLI has added our `Commands` folder and created our new class. However, the CLI has also modified our `addon.setup.php` file as well.
32
-
33
-
```
34
-
amazing_add_on
35
-
┣ Commands
36
-
┃ ┣ CommandAnAmazingCommand.php
37
-
```
38
-
39
29
CLI Commands are installed through an add-on's `addon.setup.php` file. The CLI takes care of this for us. We can see here that CLI creates the `$commands` array inside the array that gets returned from our `addon.setup.php` file.
40
30
41
31
```
@@ -61,7 +51,7 @@ return [
61
51
62
52
Now when our add-on is installed, users will have access to our new command.
63
53
64
-
## `\Commands\Command[CommandName]`
54
+
## Anatomy of a Command - `/Commands/Command[CommandName]`
65
55
Inside of our add-on we now have a file named with our command's name (in PascalCase).
66
56
67
57
In this example we have created a new command named "An Amazing Command" to our Amazing Add-on:
@@ -124,11 +114,6 @@ class CommandAnAmazingCommand extends Cli
124
114
}
125
115
```
126
116
127
-
128
-
## Anatomy of a Command
129
-
130
-
Creating commands is simple. Each commands is built in a similar way as part of a custom add-on:
131
-
132
117
### Class Structure
133
118
134
119
Your class can have any name, and should be namespaced to your addon. When creating your class, make sure to include:
Copy file name to clipboardExpand all lines: docs/development/actions.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ Actions in ExpressionEngine are URL endpoints that are reached with the `ACT` qu
16
16
17
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
18
19
-
## How To Build An Amazing Action?
19
+
## Creating An Amazing Action
20
20
To generate an action we use the CLI to add the action to our existing add-on named "Amazing Add-on".
21
21
22
22
```
@@ -90,7 +90,7 @@ On creation of an action, you can also specify to add it to the database after t
90
90
91
91
92
92
93
-
## AddonName/Module/Actions
93
+
## Anatomy of An Action
94
94
95
95
Once we've added an action to our add-on, an `Actions` folder is created inside our add-on's `Module` folder. The CLI will generate a class and respective file for us based on the action name we passed to the CLI when creating our action. In this case we added an action named "ExampleAction" to Amazing Add-on.
Copy file name to clipboardExpand all lines: docs/development/add-on-update-file.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
@@ -9,8 +9,12 @@
9
9
10
10
# Add-on Update File
11
11
12
+
## Overview
13
+
12
14
The `upd.[addon_name].php` file (commonly just called the `upd` file) is critical to ExpressionEngine knowing what to do with your add-on. Here we tell ExpressionEngine what actions to register, core hooks we want to use, database tables to update, and much more. We need to tell ExpressionEngine what to do when we install an add-on, update an add-on, and uninstall and add-on. Thankfully the CLI takes care of most of this for us.
13
15
16
+
TIP:When using the CLI, your add-on update file will automatically be created for you. 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.
17
+
14
18
## Initial Setup
15
19
16
20
When you first create your add-on using the [`make:addon`](/cli/built-in-commands/make-addon.md) command from the CLI, a `upd` file is created for you in the root of your add-on.
Copy file name to clipboardExpand all lines: docs/development/addon-setup-php-file.md
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,9 +15,14 @@ lang: php
15
15
16
16
[TOC]
17
17
18
+
## Overview
19
+
18
20
Starting with version 3.0 each add-on in ExpressionEngine must have an `addon.setup.php` file in its package directory. This file provides descriptive data about a specific add-on, such as author, name, and version. Below we walk through the format and available keys. However, most of the time, the CLI will take care of generating and updating this file as needed for you.
19
21
20
-
## Format
22
+
23
+
TIP:When using the CLI, your add-on setup file will automatically be created for you. 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
+
25
+
## Anatomy Of The Add-On Setup File
21
26
22
27
The file must return an associative array. For example:
Copy file name to clipboardExpand all lines: docs/development/custom-template-tags.md
+12-7Lines changed: 12 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ Creating your own custom template tags allows you to display dynamic data from y
23
23
24
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
25
26
-
## Creating Template Tags
26
+
## Creating An Amazing Template Tag
27
27
Tags are created via the CLI by using the `make:template-tag` command.
28
28
29
29
```
@@ -42,7 +42,10 @@ amazing_add_on
42
42
┗ ...
43
43
```
44
44
45
-
## `class [TagName]`
45
+
## Anatomy of A Template Tag
46
+
47
+
**class**`class [TagName]`
48
+
46
49
Inside `Modules/Tags/ExampleTag.php` we see the following code generated for us:
47
50
48
51
```
@@ -139,7 +142,7 @@ This would render in the browser as:
139
142
Here is some amazing text: ExpressionEngine is the best CMS in the world!
140
143
```
141
144
142
-
## Creating Tag Pair Template Tags
145
+
## Do Something - Create A Tag Pair Template Tag
143
146
144
147
Often you will want to process content contained between a pair of tags. Let's create a simple tag that makes text bold to illustrate how this is done. Our example plugin will have this syntax:
145
148
@@ -182,11 +185,13 @@ class Bold extends AbstractRoute
182
185
183
186
```
184
187
188
+
Now We need to capture the content between our opening and closing tags, and return that context as bold text. In ExpressionEngine, this is called fetching tagdata.
189
+
185
190
186
191
### Fetching Tagdata
187
192
In our class, we use `ee()->TMPL->tagdata;` to capture the template data that is between our opening and closing tag.
188
193
189
-
In this example we will capture the text we want to make bold in our template and render it back to the browser.
194
+
Let's update our example to capture the text we want to make bold in our template and render it back to the browser.
190
195
191
196
Our tag's class:
192
197
@@ -215,7 +220,7 @@ We want to bold <b>this text</b>.
215
220
216
221
As you can see, any template data between our opening and closing tags is captured using `ee()->TMPL->tagdata`.
217
222
218
-
## Parameters
223
+
## Do Something - Create A Template Tag With Parameters
219
224
Both single tags and tag pairs can accept parameters. The template engine makes it easy to fetch them using the following variable:
220
225
221
226
ee()->TMPL->fetch_param('param_name');
@@ -277,7 +282,7 @@ class format extends AbstractRoute
277
282
278
283
```
279
284
280
-
## Variables
285
+
## Using Variables In Your Template Tag
281
286
With variables, we can take our tag a step further. Imagine that you have tag pair that you want to use to return data based on some parameters. We can do that using variables inside of our tag.
282
287
283
288
We all know and love [`{exp:channel:entries}`](channels/entries.md). We use the Channel Entries tag by opening and closing the tag, passing some parameters, and then placing some template tags in our template that we know the tag will replace when rendered.
@@ -294,7 +299,7 @@ This typically looks something like this:
294
299
In the snippet above, we're passing in the `channel` and `limit` as parameters. We're then expecting the Channel Entries tag to replace the `{title}` and `{body}`**variables** when the tag is parsed. Now, let's do something similar to our add-on.
295
300
296
301
297
-
## Create A Tag With Variables
302
+
## Do Something - Create A Tag With Variables
298
303
Let's add a tag to our add-on that will render the current date and time. The user can pass in their timezone and the tag will return the current Date and time.
299
304
300
305
First, generate the tag (we're calling our tag "date and time" and adding it to our Amazing Add-On):
Copy file name to clipboardExpand all lines: docs/development/extensions.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ Within ExpressionEngine are what is known as "hooks"; little snippets of code in
21
21
22
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
23
24
-
## Creating Our Extension Files
24
+
## Creating An Amazing Extension
25
25
26
26
We can give our add-on the ability to hook into the core of ExpressionEngine by using the CLI:
27
27
@@ -47,7 +47,7 @@ amazing_add_on
47
47
48
48
TIP: A single add-on can interact with as many hooks as you want.
49
49
50
-
## `AddonName/Extensions`
50
+
## Anatomy Of An Extension
51
51
Once we've added the ability to hook into the core with our add-on, an `Extensions` folder is created. The CLI will generate a class and a respective file for each core hook we wish to use.
52
52
53
53
Here we have added the ability to interact with the [`typography_parse_type_end()`](/development/extension-hooks/global/typography.html#typography_parse_type_endstr-this-prefs) hook.
Copy file name to clipboardExpand all lines: docs/development/fieldtypes/fieldtypes.md
+5-6Lines changed: 5 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ TIP: For an overview of what a Fieldtype is, read the [Fieldtype Overview docs](
22
22
23
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.
24
24
25
-
## Creating A Custom Fieldtype
25
+
## Creating An Amazing Fieldtype
26
26
27
27
Adding a custom fieldtype to your add-on is easy with the `make:fieldtype` command.
28
28
@@ -44,7 +44,9 @@ amazing_add_on
44
44
┗ ...
45
45
```
46
46
47
-
## Basic Fieldtype File Structure
47
+
## Anatomy of A Fieldtype
48
+
49
+
[TOC=3]
48
50
49
51
All fieldtypes must inherit from the `EE_Fieldtype` base class and they must provide an `$info` array with a name and version number.
50
52
@@ -78,9 +80,6 @@ NOTE: **Note:** Fieldtypes can declare their compatibility with other Fieldtypes
78
80
NOTE: We also have [Example fieldtype with annotations](development/fieldtypes/example.md) for your reference.
79
81
80
82
81
-
## Development Reference
82
-
83
-
[TOC=3]
84
83
85
84
### Class Variables
86
85
@@ -573,6 +572,6 @@ A jQuery object of the field being affected by the current event is passed to th
573
572
574
573
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.
575
574
576
-
## Do Something: Build A Fieldtype
575
+
## Do Something - Build A Fieldtype
577
576
578
577
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
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
0---
1
+
---
2
2
lang: php
3
3
---
4
4
@@ -22,7 +22,7 @@ NOTE:**NOTE:** Control Pages are what is rendered in the browser when visiting y
22
22
23
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
24
25
-
## Generate Your Route
25
+
## Creating An Amazing Control Panel Route
26
26
27
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.
28
28
@@ -37,7 +37,7 @@ This will create an `mcp.[addon_name].php` file in your add-on along with a `Mcp
37
37
Inside of the `Mcp` folder, you will see that the CLI has created your first control route with `Mcp/Index.php` and a corresponding view in you `views` folder. This page is accessible via The Add-On Manager -> [Add-On Name] or via the `/admin.php?/cp/addons/settings/[add-on-name]` URL.
38
38
39
39
40
-
## Your First Control Panel Page
40
+
## Anatomy Of A Control Panel Route
41
41
When you first add a route to your add-on an `Mcp` folder along with an `Mcp/Index.php` starter file is created. The starter file will look something like this:
Copy file name to clipboardExpand all lines: docs/development/prolets.md
+2-3Lines changed: 2 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ Here is an example of the add-on SEEO's prolet, which easily allows editors to e
20
20
21
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
22
23
-
## Creating A Prolet
23
+
## Creating An Amazing Prolet
24
24
25
25
Creating a Prolet is straightforward using the `make:prolet` command in the CLI.
26
26
@@ -40,7 +40,7 @@ amazing_add_on
40
40
```
41
41
42
42
43
-
## Prolet File Structure
43
+
## Anatomy Of A Prolet
44
44
45
45
Inside a prolet file, you are required to define the prolet class. The class name should consist of prolet name with the first letter capitalized followed by `_pro` postfix. So for the example above, the class name will be `Sample_prolet_pro`.
46
46
@@ -68,7 +68,6 @@ class Amazing_add_on_pro extends AbstractProlet implements ProletInterface
68
68
}
69
69
```
70
70
71
-
## Properties and Methods
72
71
73
72
### Icon
74
73
On each page load, prolets appear on the front-end as Dock buttons. If not specified otherwise, `icon.svg` from the add-on package folder is used as the Dock button. If you want to specify a different icon to use from the add-on's folder, you can do that using `protected $icon` property or `public function getIcon()`.
Copy file name to clipboardExpand all lines: docs/development/tab-files.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,7 @@ lang: php
14
14
15
15
# Adding Publish Layout Tabs
16
16
17
+
[TOC]
17
18
18
19
## Overview
19
20
Add-ons can also add tabs which are visible on in [Publish Layouts](control-panel/channels.md#publish-layouts). Respectivley these tabs would also be visible on the Entry Publish/Edit page if selected in the publish layout. Two things are required for your add-on to have this functionality:
@@ -25,7 +26,7 @@ Here is an example of the publish layout's tab for the Structure add-on:
25
26
26
27
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
28
28
-
## Creating The Tab File
29
+
## Creating An Amazing Tab File
29
30
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.
0 commit comments