Skip to content

Commit b43db32

Browse files
author
Andy McCormick
committed
updated tags page
1 parent 4f60dc6 commit b43db32

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

docs/development/custom-template-tags.md

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,30 +28,34 @@ Tags are created via the CLI by using the `make:template-tag` command.
2828

2929
```
3030
php system/ee/eecli.php make:template-tag
31+
Let's build a new tag!
32+
What is the tag name? Amazing
33+
What add-on is the tag being added to? [amazing_add_on]: amazing_add_on
34+
Building Tag.
35+
Tag created successfully!
3136
```
3237

3338
Follow the prompts to add a tag file to your add-on.
3439

35-
This will create an `Models/Tags` folder in your add-on.
40+
This will create a `Tags` folder in your add-on.
3641

3742
```
3843
amazing_add_on
39-
┣ Module
40-
┃ ┗ Tags
41-
┃ ┃ ┗ ExampleTag.php
44+
┣ Tags
45+
┃ ┗ AmazingTag.php
4246
┗ ...
4347
```
4448

4549
## Anatomy of A Template Tag
4650

4751
**class** `class [TagName]`
4852

49-
Inside `Modules/Tags/ExampleTag.php` we see the following code generated for us:
53+
Inside `Tags/ExampleTag.php` we see the following code generated for us:
5054

5155
```
5256
<?php
5357
54-
namespace ExpressionengineDeveloper\AmazingAddOn\Module\Tags;
58+
namespace ExpressionengineDeveloper\AmazingAddOn\Tags;
5559
5660
use ExpressionEngine\Service\Addon\Controllers\Tag\AbstractRoute;
5761
@@ -115,7 +119,7 @@ This generates the class for our add-on:
115119
```
116120
<?php
117121
118-
namespace ExpressionengineDeveloper\AmazingAddOn\Module\Tags;
122+
namespace ExpressionengineDeveloper\AmazingAddOn\Tags;
119123
120124
use ExpressionEngine\Service\Addon\Controllers\Tag\AbstractRoute;
121125
@@ -165,12 +169,12 @@ What add-on is the tag being added to? [amazing_add_on,...]: amazing_add_on
165169
Tag created successfully!
166170
```
167171

168-
Now we have our template tag's class located at `Modules/Tags/Bold.php`:
172+
Now we have our template tag's class located at `Tags/Bold.php`:
169173

170174
```
171175
<?php
172176
173-
namespace ExpressionengineDeveloper\AmazingAddOn\Module\Tags;
177+
namespace ExpressionengineDeveloper\AmazingAddOn\Tags;
174178
175179
use ExpressionEngine\Service\Addon\Controllers\Tag\AbstractRoute;
176180
@@ -245,12 +249,12 @@ What add-on is the tag being added to? [amazing_add_on,...]: amazing_add_on
245249
Tag created successfully!
246250
```
247251

248-
Now we have our template tag's class located at `Modules/Tags/Format.php`:
252+
Now we have our template tag's class located at `Tags/Format.php`:
249253

250254
```
251255
<?php
252256
253-
namespace ExpressionengineDeveloper\AmazingAddOn\Module\Tags;
257+
namespace ExpressionengineDeveloper\AmazingAddOn\Tags;
254258
255259
use ExpressionEngine\Service\Addon\Controllers\Tag\AbstractRoute;
256260
@@ -311,10 +315,10 @@ What add-on is the tag being added to? [amazing_add_on,...]: amazing_add_on
311315
Tag created successfully!
312316
```
313317

314-
Now, let's update the `DateAndTime` class (`Module/Tags/DateAndTime.php`) to read the timezone that is passed in:
318+
Now, let's update the `DateAndTime` class (`Tags/DateAndTime.php`) to read the timezone that is passed in:
315319

316320
```
317-
namespace ExpressionengineDeveloper\AmazingAddOn\Module\Tags;
321+
namespace ExpressionengineDeveloper\AmazingAddOn\Tags;
318322
319323
use ExpressionEngine\Service\Addon\Controllers\Tag\AbstractRoute;
320324
@@ -333,7 +337,7 @@ class DateAndTime extends AbstractRoute
333337
Now we drop in some magic using the `TMPL::parse_variables` method that's provided by the [`Template Class`](development/legacy/libraries/template.md). Here we'll get the current date and time, then create an array of variables the user can use in their template to show the current date and time.
334338

335339
```
336-
namespace ExpressionengineDeveloper\AmazingAddOn\Module\Tags;
340+
namespace ExpressionengineDeveloper\AmazingAddOn\Tags;
337341
338342
use ExpressionEngine\Service\Addon\Controllers\Tag\AbstractRoute;
339343

0 commit comments

Comments
 (0)