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/extensions.md
+10-8Lines changed: 10 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,21 +17,21 @@ lang: php
17
17
18
18
## Overview
19
19
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 backend scripts.
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
-
## Generate Our Files
22
+
## Generate Our Extension Files
23
23
24
24
We can give our add-on the ability to hook into the core of ExpressionEngine by using the CLI:
25
25
26
26
```
27
-
php system/ee/eecli.php make:extension-hook
27
+
$ php system/ee/eecli.php make:extension-hook
28
28
```
29
29
30
30
Follow the prompts to add an extension file to your add-on.
31
31
32
32
TIP: Files that interact with ExpressionEngine core hooks are referred to as "extensions" because they extend the functionality of ExpressionEngine.
33
33
34
-
This will create an `ext[addon_name].php` file in our add-on along with an `Extensions` folder where will build out the code we want to run when we interact with a core hook. Inside our `Extensions` folder the CLI will create a file with the same name as the core hook we plan to use.
34
+
This will create an `ext[addon_name].php` file in our add-on along with an `Extensions` folder where we will build out the code we want to run when we interact with a core hook. Inside our `Extensions` folder the CLI will create a file with the same name as the core hook we plan to use.
35
35
36
36
```
37
37
amazing_add_on
@@ -47,8 +47,8 @@ TIP: A single add-on can interact with as many hooks as you want.
47
47
48
48
Prior to ExpressionEngine 6.4.0 and 7.2.0, all code that was used to hook into the core was placed in our `ext.[addon_name].php` file. However, now that file mainly just extends the `Extension` service and routes ExpressionEngine to reference the `Extensions` folder in our add-on.
49
49
50
-
## `AddonName\Extensions`
51
-
Once we've added the abillity 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.
50
+
## `AddonName/Extensions`
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.
54
54
@@ -86,9 +86,9 @@ class TypographyParseTypeEnd extends AbstractRoute
86
86
87
87
As we can see, the CLI has correctly created a new class using our core hook in PascalCase as the name.
88
88
89
-
Inside our class is the `process()` function. Again the CLI has already added all parameters that will be passed in from the core hook. Reference the Available Core Hooks section of the docs to read on what parameters your hook uses.
89
+
Inside our class is the `process()` function. Again the CLI has already added all parameters that will be passed in from the core hook. Reference the [Available Core Hooks]() section of the docs to read on what parameters your hook uses.
90
90
91
-
From the [`typography_parse_type_end()`](/development/extension-hooks/global/typography.html#typography_parse_type_endstr-this-prefs) docs we can see that this hook modifies string after all other typography is processed. Thus we should be able to take a string, manipulate it, then pass it back to ExpressionEngine to be rendered in the template.
91
+
From the [`typography_parse_type_end()`](/development/extension-hooks/global/typography.html#typography_parse_type_endstr-this-prefs) docs we can see that this hook modifies a string after all other typography is processed. Thus we should be able to take a string, manipulate it, then pass it back to ExpressionEngine to be rendered in the template.
92
92
93
93
We know that we should expect the following parameters for this hook:
94
94
@@ -117,6 +117,8 @@ class TypographyParseTypeEnd extends AbstractRoute
0 commit comments