Skip to content

Commit 1caff04

Browse files
Update modifiers.md
1 parent 2bc194f commit 1caff04

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

docs/development/modifiers.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,36 @@
33
ExpressionEngine User Guide (https://github.com/ExpressionEngine/ExpressionEngine-User-Guide)
44
55
@link https://expressionengine.com/
6-
@copyright Copyright (c) 2003-2021, Packet Tide, LLC (https://packettide.com)
6+
@copyright Copyright (c) 2003-2023, Packet Tide, LLC (https://packettide.com)
77
@license https://expressionengine.com/license Licensed under Apache License, Version 2.0
88
-->
99

1010
# Developing Variable Modifiers
1111

12-
The add-ons can provide their own [variable modifiers](templates/variable-modifiers.md)
12+
Add-ons can provide their own [variable modifiers](templates/variable-modifiers.md) for use in templates.
1313

14-
Each variable modifier needs be created as a separate file in `Modifiers` directory within add-on's own folder and registered in `addon.setup.php`.
14+
Each variable modifier needs be created as a separate file in the `Modifiers` directory within the add-on's root folder, and registered in `addon.setup.php`.
1515

16-
The file name (which will also be PHP class name) should be the modifier's name with first letter capitalized.
16+
The file name, which is also the PHP class name, should be the modifier's name with the first letter capitalized.
1717

1818
All modifier files are required to implement `ExpressionEngine\Service\Template\Variables\ModifierInterface`.
1919

20-
Each widget should have `namespace` definition, which should consist of the add-on's namespace as defined in `addon.setup.php` followed by `\Modifiers`.
20+
Each modifier should have a `namespace` definition, which consists of the add-on's namespace as defined in `addon.setup.php` followed by `\Modifiers`.
2121

22-
Lastly, the modifier's name should be registered in `addon.setup.php`
22+
Lastly, the modifier's name should be registered in `addon.setup.php`.
2323

24-
TIP: **Tip:** Modifiers provided by add-on can be called by their name as well as by their name prefixed with add-on's name and underscore. For example below we can use `{title:hacker}` and `{title:seo_hacker}` to achieve same result
24+
TIP: **Tip:** Modifiers provided by add-ons can be called by their name as well as by their name prefixed with add-on's name and underscore. For example, below we can use `{title:hacker}` and `{title:seeo_hacker}` to achieve the same result.
2525

2626
### Example
2727

28-
Let's create `:hacker` modifier which would make text look geeky by converting some letters to numbers that look similarly. The modifier would be part of "Seeo" add-on.
28+
Let's create the `:hacker` modifier, which would make text look geeky by converting some of the letters to similar looking numbers. This example modifier is part of the "Seeo" add-on.
2929

3030
<?php
3131

3232
/**
3333
* namespace is required and must be add-on's namespace + 'Modifiers'
3434
*
3535
*/
36-
<?php
37-
3836
namespace EEHarbor\Seeo\Modifiers;
3937

4038
use ExpressionEngine\Service\Template\Variables\ModifierInterface;
@@ -50,10 +48,10 @@ Let's create `:hacker` modifier which would make text look geeky by converting s
5048
Next, we'll add the following to `addon.setup.php`
5149

5250
'modifiers' => array(
53-
'hacker'
54-
),
51+
'hacker'
52+
),
5553

56-
And now, let's call it in template.
54+
And now, let's call it in a template.
5755

5856
{exp:channel:entries entry_id="1"}
5957
<div class="title">
@@ -65,4 +63,4 @@ And now, let's call it in template.
6563
<div class="seeo_hacker">
6664
<span>{title:seeo_hacker}</span> - H3110
6765
</div>
68-
{/exp:channel:entries}
66+
{/exp:channel:entries}

0 commit comments

Comments
 (0)