Skip to content

Commit 4f60dc6

Browse files
author
Andy McCormick
committed
updated actions page
1 parent 2aaa66f commit 4f60dc6

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

docs/development/actions.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,12 @@ php system/ee/eecli.php make:action
2626
Follow the prompts to add an action file to your add-on.
2727

2828

29-
This will create an `Actions` folder inside our `Module` folder where will build out the code we want to run when a user hits our `ACT` URL. Inside our `Actions` folder the CLI will create a file with the same name as the method we defined when creating our action.
29+
This will create an `Actions` folder inside our add-on's folder where will build out the code we want to run when a user hits our `ACT` URL. Inside our `Actions` folder the CLI will create a file with the same name as the method we defined when creating our action.
3030

3131
```
3232
amazing_add_on
33-
┣ Module
34-
┃ ┣ Actions
35-
┃ ┃ ┗ [MethodName].php
33+
┣ Actions
34+
┃ ┗ [MethodName].php
3635
┗...
3736
```
3837

@@ -92,7 +91,7 @@ On creation of an action, you can also specify to add it to the database after t
9291

9392
## Anatomy of An Action
9493

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.
94+
Once we've added an action to our add-on, an `Actions` folder is created for us. 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.
9695

9796
```
9897
php system/ee/eecli.php make:action
@@ -103,21 +102,20 @@ Action created successfully!
103102

104103
```
105104
amazing_add_on
106-
┣ Module
107-
┃ ┣ Actions
108-
┃ ┃ ┗ ExampleAction.php
105+
┣ Actions
106+
┃ ┗ ExampleAction.php
109107
┗...
110108
```
111109

112110

113111
### class [ActionName]
114112

115-
Inside `Module/Actions/ExampleAction.php` we see the following code generated for us:
113+
Inside `/Actions/ExampleAction.php` we see the following code generated for us:
116114

117115
```
118116
<?php
119117
120-
namespace ExpressionengineDeveloper\AmazingAddon\Module\Actions;
118+
namespace ExpressionengineDeveloper\AmazingAddon\Actions;
121119
122120
use ExpressionEngine\Service\Addon\Controllers\Action\AbstractRoute;
123121
@@ -148,7 +146,7 @@ The `exp_actions` table is comprised of 4 columns:
148146

149147
## Cross Site Request Forgery(CSRF) Exemption
150148

151-
WARN:**Security Alert:**Setting your action to CSRF EXempt, also makes this endpoint less secure though as you are allowing outside connections to your application.
149+
WARN:**Security Alert:**Setting your action to CSRF Exempt, also makes this endpoint less secure though as you are allowing outside connections to your application.
152150

153151
For security reasons, actions are protected by [Cross Site Request Forgery(CSRF)](/development/guidelines/security.md#cross-site-request-forgery). If you want users to be able to reach this endpoint from outside your site (e.g. using cURL to from another domain or application to reach this endpoint and expect data to be returned ) then you will most likely need to make your action CSRF exempt.
154152

@@ -195,12 +193,12 @@ This creates our required files.
195193

196194
Now we had some functionality to our action which will add the first and last name submitted from a form to our custom database table.
197195

198-
Our action's code (`Module/Actions/ExampleAction.php`):
196+
Our action's code (`Actions/ExampleAction.php`):
199197

200198
```
201199
<?php
202200
203-
namespace ExpressionengineDeveloper\AmazingAddOn\Module\Actions;
201+
namespace ExpressionengineDeveloper\AmazingAddOn\Actions;
204202
205203
use ExpressionEngine\Service\Addon\Controllers\Action\AbstractRoute;
206204
@@ -266,7 +264,7 @@ Our action code:
266264
```
267265
<?php
268266
269-
namespace ExpressionengineDeveloper\AmazingAddOn\Module\Actions;
267+
namespace ExpressionengineDeveloper\AmazingAddOn\Actions;
270268
271269
use ExpressionEngine\Service\Addon\Controllers\Action\AbstractRoute;
272270

0 commit comments

Comments
 (0)