Skip to content

Commit 109f2a7

Browse files
committed
updated code exmaples to include private var add-on name... also updated example of auto upgrades to add-ons
1 parent 4a261ee commit 109f2a7

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

docs/development/automated-upgrading.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,20 @@ class My_awesome_plugin_upgrade {
3434
}
3535
3636
if(version_compare($version, '4.0.0', '=')) {
37-
// Run updates for upgrade to EE3
37+
// Run updates for upgrade to EE4
38+
}
39+
40+
if(version_compare($version, '5.0.0', '=')) {
41+
// Run updates for upgrade to EE5
3842
}
3943
44+
if(version_compare($version, '6.0.0', '=')) {
45+
// Run updates for upgrade to EE6
46+
}
47+
48+
if(version_compare($version, '7.0.0', '=')) {
49+
// Run updates for upgrade to EE7
50+
}
4051
}
4152
4253
}

docs/development/modernizing-existing-add-ons.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,34 +25,41 @@ To utilize the updated method for creating add-ons, you will need to make some s
2525
[TOC]
2626

2727
## Updating your mod.addon.php file
28-
In order to use the new approach, you will have to have your mod file use and extend the module add-on service
28+
In order to use the new approach, you will have to have your mod file use and extend the module add-on service. Your mod file will also need to add the protected variable $addon_name in the class
2929

3030

3131
```
3232
use ExpressionEngine\Service\Addon\Module;
3333
34-
class Addon extends Module
34+
class Amazing_add_on extends Module
35+
{
36+
protected $addon_name = 'amazing_add_on';
3537
3638
```
3739

40+
3841
## Updating your mcp.addon.php file
3942

40-
In order to use the new approach, you will have to have your mcp file use and extend the Mcp add-on service
43+
In order to use the new approach, you will have to have your mcp file use and extend the Mcp add-on service. Your mcp file will also need to add the protected variable $addon_name in the class
4144

4245
```
4346
use ExpressionEngine\Service\Addon\Mcp;
4447
45-
class Addon_mcp extends Mcp
48+
class Amazing_add_on_mcp extends Mcp
49+
{
50+
protected $addon_name = 'amazing_add_on';
4651
```
4752

4853
## Updating your ext.addon.php file
4954

50-
In order to use the new approach, you will have to have your ext file use and extend the Extension add-on service
55+
In order to use the new approach, you will have to have your ext file use and extend the Extension add-on service. Your ext file will also need to add the protected variable $addon_name in the class
5156

5257
```
5358
use ExpressionEngine\Service\Addon\Extension;
5459
55-
class Addon_ext extends Extension
60+
class Amazing_add_on_ext extends Extension
61+
{
62+
protected $addon_name = 'amazing_add_on';
5663
```
5764

5865
## Updating your upd.addon.php file
@@ -62,7 +69,8 @@ In order to use the new approach, you will have to have your upd file use and ex
6269
```
6370
use ExpressionEngine\Service\Addon\Installer;
6471
65-
class Addon_upd extends Installer
72+
class Amazing_add_on_upd extends Installer
73+
{
6674
```
6775
## A Note on Plugins
6876
If your add-on is currently a plugin and you are looking to take advantage of the new add-on development methodologies, we recommend migrating your plugin methods (functions) to your mod file first. This can be done with a simple copy and paste.

docs/toc_sections/_advanced_usage_toc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@
164164
href: development/widgets.md
165165
#- name: REMOVE - Adding Text Formatting Options
166166
# href: development/text-formatting.md
167+
- name: Modernizing add-ons
168+
href: development/modernizing-existing-add-ons.md
167169
- name: Accessing the Database
168170
href: development/database-access.md
169171

@@ -612,8 +614,6 @@
612614
href: development/guidelines/security.md
613615
- name: View Files and PHP Syntax
614616
href: development/guidelines/view-php-syntax.md
615-
- name: Modernizing add-ons
616-
href: development/modernizing-existing-add-ons.md
617617
- name: Debugging
618618
href: development/debugging.md
619619
- name: v3 Add-on Migration

0 commit comments

Comments
 (0)