From 5ae69e95e03de1944c0d5ac47cba4061a40f7ce5 Mon Sep 17 00:00:00 2001 From: Tom Jaeger Date: Mon, 23 Jan 2023 11:50:09 -0500 Subject: [PATCH 01/13] adding base of new docs for modernizing existing add-ons --- docs/development/extensions.md | 3 +- .../modernizing-existing-add-ons.md | 68 +++++++++++++++++++ docs/toc_sections/_advanced_usage_toc.yml | 2 + 3 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 docs/development/modernizing-existing-add-ons.md diff --git a/docs/development/extensions.md b/docs/development/extensions.md index fc22ce741..95771db47 100755 --- a/docs/development/extensions.md +++ b/docs/development/extensions.md @@ -26,7 +26,7 @@ NOTE:Before adding an extension hook to your add-on, you need to already have an We can give our add-on the ability to hook into the core of ExpressionEngine by using the CLI: ``` -$ php system/ee/eecli.php make:extension-hook +$ php system/ee/eecli.php make:extension-hook -i Let's implement an extension hook! What hooks would you like to use? (Read more: https://docs.expressionengine.com/latest/development/extensions.html) typography_parse_type_end What add-on is the extension hook being added to? [amazing_add_on]: amazing_add_on @@ -35,6 +35,7 @@ Extension hook created successfully! ``` +NOTE: If your using the command above to add an extention to an existing add-on, please see the [Updating Existing Add-ons](LINK GOES HERE) TIP: Files that interact with ExpressionEngine core hooks are referred to as "extensions" because they extend the functionality of ExpressionEngine. diff --git a/docs/development/modernizing-existing-add-ons.md b/docs/development/modernizing-existing-add-ons.md new file mode 100644 index 000000000..8e3eb6a1a --- /dev/null +++ b/docs/development/modernizing-existing-add-ons.md @@ -0,0 +1,68 @@ + + +# Modernizing Existing Add-ons + + + +The ExpressionEngine 7.2 release brough a new add-on developemnt approach, which generates the majority of the add-ons needed files and struture. It also bring additional organization to how add-ons are developed. + +NOTE: These changes do NOT break existing add-ons. The old development methodologies will still work. + +The idea of a plugin, module, extension, fieldtype, etc. no longer exist. Instead an add-on can have a template tag, or a field-type, or an extention. + +In order to harness the new add-on development methodology, you will have to do a few SMALL updates to your existing add-on's. + +TIP: You don't have to migrate your add-on to the new development methodology. After making the following changes, you can leave your add-ons as is, and start with new / additional development in the new method. + + +[TOC] + +## Updating your mod.addon.php file +In order to use the new approach, you will have to have your mod file use and extend the module addon service + + +``` +use ExpressionEngine\Service\Addon\Module; + +class Addon extends Module + +``` + +## Updating your mcp.addon.php file + +In order to use the new approach, you will have to have your mcp file use and extend the Mcp addon service + +``` +use ExpressionEngine\Service\Addon\Mcp; + +class Addon_mcp extends Mcp +``` + +## Updating your ext.addon.php file + +In order to use the new approach, you will have to have your mcp file use and extend the Extension addon service + +``` +use ExpressionEngine\Service\Addon\Extension; + +class Addon_ext extends Extension +``` + +## Updating your upd.addon.php file + +In order to use the new approach, you will have to have your mcp file use and extend the Instaler addon service + +``` +use ExpressionEngine\Service\Addon\Installer; + +class Addon_upd extends Installer +``` +## A Note on Plugins +If your add-on is currently a plugin and your looking to take advantage of the new add-on development methodologies, we recommend migrating your plugin methods (functions) to your mod file first. \ No newline at end of file diff --git a/docs/toc_sections/_advanced_usage_toc.yml b/docs/toc_sections/_advanced_usage_toc.yml index 67530e8bd..ac537dab4 100644 --- a/docs/toc_sections/_advanced_usage_toc.yml +++ b/docs/toc_sections/_advanced_usage_toc.yml @@ -162,6 +162,8 @@ href: development/prolets.md - name: Adding Dashboard Widgets href: development/widgets.md + - name: Modernizing existing add-ons + href: development/modernizing-existing-add-ons.md #- name: REMOVE - Adding Text Formatting Options # href: development/text-formatting.md - name: Accessing the Database From 68d6a89d6535015c0f6da603e46ea4b9f50e1aa2 Mon Sep 17 00:00:00 2001 From: Tom Jaeger Date: Mon, 23 Jan 2023 12:02:41 -0500 Subject: [PATCH 02/13] added links to modernizing add-ons --- docs/development/actions.md | 2 ++ docs/development/addon-development-overview.md | 4 +++- docs/development/custom-template-tags.md | 1 + docs/development/extensions.md | 1 + docs/development/modernizing-existing-add-ons.md | 4 ++-- docs/development/modules.md | 1 + docs/toc_sections/_advanced_usage_toc.yml | 4 ++-- 7 files changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/development/actions.md b/docs/development/actions.md index 9a59befcb..92ff9ee64 100644 --- a/docs/development/actions.md +++ b/docs/development/actions.md @@ -9,6 +9,8 @@ # Actions +TIP: If your working with an existing add-on we recommend you start with [Modernizing add-ons](development/modernizing-existing-add-ons.md) + [TOC] ## Overview diff --git a/docs/development/addon-development-overview.md b/docs/development/addon-development-overview.md index 3938b193a..9601d0e5d 100644 --- a/docs/development/addon-development-overview.md +++ b/docs/development/addon-development-overview.md @@ -32,7 +32,9 @@ Here are some ideas of what you can accomplish with a custom add-on: These are just a few ideas of what you can do with custom add-ons. The possibilities are almost endless. ## Getting Started -Getting started making an add-on is incredibly easy with the CLI. To begin making an add-on simply, use the `make:addon` command from the [CLI](/cli/intro.html). +Getting started making an add-on is incredibly easy with the CLI. To begin making an add-on simply, use the `make:addon` command from the [CLI](/cli/intro.html). + +TIP: If your working with an existing add-on we recommend you start with [Modernizing add-ons](development/modernizing-existing-add-ons.md) ``` $ php system/ee/eecli.php make:addon diff --git a/docs/development/custom-template-tags.md b/docs/development/custom-template-tags.md index f3c0976af..e62ee8037 100644 --- a/docs/development/custom-template-tags.md +++ b/docs/development/custom-template-tags.md @@ -12,6 +12,7 @@ lang: php --> # Adding Template Tags +TIP: If your working with an existing add-on we recommend you start with [Modernizing add-ons](development/modernizing-existing-add-ons.md) [TOC] diff --git a/docs/development/extensions.md b/docs/development/extensions.md index 95771db47..1a2964691 100755 --- a/docs/development/extensions.md +++ b/docs/development/extensions.md @@ -12,6 +12,7 @@ lang: php --> # Extensions and Hooks +TIP: If your working with an existing add-on we recommend you start with [Modernizing add-ons](development/modernizing-existing-add-ons.md) [TOC] diff --git a/docs/development/modernizing-existing-add-ons.md b/docs/development/modernizing-existing-add-ons.md index 8e3eb6a1a..495af7a55 100644 --- a/docs/development/modernizing-existing-add-ons.md +++ b/docs/development/modernizing-existing-add-ons.md @@ -19,7 +19,7 @@ The idea of a plugin, module, extension, fieldtype, etc. no longer exist. Inste In order to harness the new add-on development methodology, you will have to do a few SMALL updates to your existing add-on's. -TIP: You don't have to migrate your add-on to the new development methodology. After making the following changes, you can leave your add-ons as is, and start with new / additional development in the new method. +TIP: You don't have to migrate your add-on to the new development methodology. After making the following changes, you can leave your add-ons as is, and start new / additional development in the new method. [TOC] @@ -65,4 +65,4 @@ use ExpressionEngine\Service\Addon\Installer; class Addon_upd extends Installer ``` ## A Note on Plugins -If your add-on is currently a plugin and your looking to take advantage of the new add-on development methodologies, we recommend migrating your plugin methods (functions) to your mod file first. \ No newline at end of file +If your add-on is currently a plugin and your 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. \ No newline at end of file diff --git a/docs/development/modules.md b/docs/development/modules.md index db0c5a5ca..bf6e31810 100755 --- a/docs/development/modules.md +++ b/docs/development/modules.md @@ -12,6 +12,7 @@ lang: php --> # Add Control Panel Pages To Your Add-On +TIP: If your working with an existing add-on we recommend you start with [Modernizing add-ons](development/modernizing-existing-add-ons.md) [TOC=2-3] diff --git a/docs/toc_sections/_advanced_usage_toc.yml b/docs/toc_sections/_advanced_usage_toc.yml index ac537dab4..e7a2151fc 100644 --- a/docs/toc_sections/_advanced_usage_toc.yml +++ b/docs/toc_sections/_advanced_usage_toc.yml @@ -162,8 +162,6 @@ href: development/prolets.md - name: Adding Dashboard Widgets href: development/widgets.md - - name: Modernizing existing add-ons - href: development/modernizing-existing-add-ons.md #- name: REMOVE - Adding Text Formatting Options # href: development/text-formatting.md - name: Accessing the Database @@ -614,6 +612,8 @@ href: development/guidelines/security.md - name: View Files and PHP Syntax href: development/guidelines/view-php-syntax.md + - name: Modernizing add-ons + href: development/modernizing-existing-add-ons.md - name: Debugging href: development/debugging.md - name: v3 Add-on Migration From 1019bcc0a6f7e7cd25af46773fdbfa9c5d9ed9f3 Mon Sep 17 00:00:00 2001 From: Matt Johnson Date: Mon, 23 Jan 2023 11:26:37 -0600 Subject: [PATCH 03/13] Update actions.md --- docs/development/actions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/development/actions.md b/docs/development/actions.md index 92ff9ee64..951d601a9 100644 --- a/docs/development/actions.md +++ b/docs/development/actions.md @@ -9,7 +9,7 @@ # Actions -TIP: If your working with an existing add-on we recommend you start with [Modernizing add-ons](development/modernizing-existing-add-ons.md) +TIP: If you are working with an existing add-on, we recommend you start with [Modernizing add-ons](development/modernizing-existing-add-ons.md) [TOC] From fc9c22a0c7b895ccf4a18fe00887dee4267d10b3 Mon Sep 17 00:00:00 2001 From: Matt Johnson Date: Mon, 23 Jan 2023 11:27:46 -0600 Subject: [PATCH 04/13] Update addon-development-overview.md --- docs/development/addon-development-overview.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/development/addon-development-overview.md b/docs/development/addon-development-overview.md index 9601d0e5d..b79f3d16b 100644 --- a/docs/development/addon-development-overview.md +++ b/docs/development/addon-development-overview.md @@ -32,9 +32,9 @@ Here are some ideas of what you can accomplish with a custom add-on: These are just a few ideas of what you can do with custom add-ons. The possibilities are almost endless. ## Getting Started -Getting started making an add-on is incredibly easy with the CLI. To begin making an add-on simply, use the `make:addon` command from the [CLI](/cli/intro.html). +Getting started making an add-on is incredibly easy with the CLI. To begin making an add-on, simply use the `make:addon` command from the [CLI](/cli/intro.html). -TIP: If your working with an existing add-on we recommend you start with [Modernizing add-ons](development/modernizing-existing-add-ons.md) +TIP: If you are working with an existing add-on, we recommend you start with [Modernizing add-ons](development/modernizing-existing-add-ons.md) ``` $ php system/ee/eecli.php make:addon @@ -221,4 +221,4 @@ In the past, add-ons were often categorized based on their functionality. We ide With the release of 6.4.x and 7.2.x this paradigm has been updated to reflect the idea that we are just creating add-ons, and those add-ons can have multiple types of functionality. The CLI has also been updated to make creating add-ons and adding functionality incredibly easy. We have also updated the docs to reflect the ideal workflow of creating an add-on. -While the latest changes shift our view of add-ons and how developers will create add-ons, you may still come across add-ons using the old methodology. We have left much of the old methods and structure in place in the core so that older add-ons will continue to work. However, we are choosing to not actively update the documentation for the old methods because we feel it's no longer in the best interest of the community to develop add-ons in this way. If you need to access how the docs once were regarding add-ons, you can reference the [legacy docs in GitHub](https://github.com/ExpressionEngine/ExpressionEngine-User-Guide/releases/tag/legacy-add-on-structure) (note that v7 and v6 were the same in these regards). \ No newline at end of file +While the latest changes shift our view of add-ons and how developers will create add-ons, you may still come across add-ons using the old methodology. We have left much of the old methods and structure in place in the core so that older add-ons will continue to work. However, we are choosing to not actively update the documentation for the old methods because we feel it's no longer in the best interest of the community to develop add-ons in this way. If you need to access how the docs once were regarding add-ons, you can reference the [legacy docs in GitHub](https://github.com/ExpressionEngine/ExpressionEngine-User-Guide/releases/tag/legacy-add-on-structure) (note that v7 and v6 were the same in these regards). From 613e448eaf40764ab4b3570b5fbde1f23c660eb1 Mon Sep 17 00:00:00 2001 From: Matt Johnson Date: Mon, 23 Jan 2023 11:28:45 -0600 Subject: [PATCH 05/13] Update modules.md --- docs/development/modules.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/development/modules.md b/docs/development/modules.md index bf6e31810..610dc6f44 100755 --- a/docs/development/modules.md +++ b/docs/development/modules.md @@ -12,7 +12,7 @@ lang: php --> # Add Control Panel Pages To Your Add-On -TIP: If your working with an existing add-on we recommend you start with [Modernizing add-ons](development/modernizing-existing-add-ons.md) +TIP: If you are working with an existing add-on, we recommend you start with [Modernizing add-ons](development/modernizing-existing-add-ons.md) [TOC=2-3] @@ -520,4 +520,4 @@ ExpressionEngine includes both its own JavaScript library as well as the [The jQ - After defining any JavaScript output, you must compile in order to display it: - ee()->javascript->compile(); \ No newline at end of file + ee()->javascript->compile(); From 0b5a705f934a045ab678e32eb48d2d45d2d93c21 Mon Sep 17 00:00:00 2001 From: Matt Johnson Date: Mon, 23 Jan 2023 11:29:41 -0600 Subject: [PATCH 06/13] Update custom-template-tags.md --- docs/development/custom-template-tags.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/development/custom-template-tags.md b/docs/development/custom-template-tags.md index e62ee8037..c5b747cad 100644 --- a/docs/development/custom-template-tags.md +++ b/docs/development/custom-template-tags.md @@ -12,7 +12,7 @@ lang: php --> # Adding Template Tags -TIP: If your working with an existing add-on we recommend you start with [Modernizing add-ons](development/modernizing-existing-add-ons.md) +TIP: If you are working with an existing add-on, we recommend you start with [Modernizing add-ons](development/modernizing-existing-add-ons.md) [TOC] @@ -390,4 +390,4 @@ The current date is: November 15, 2022 The current time is: 02:40 PM ``` -TIP: Of course, this is only the beginning of what you can do with variables in your tag. We created single variables here, but you can create pair variables and much more. For more information about this, and manipulating the tagdata in your plugin, check out the [Template Class](development/legacy/libraries/template.md). \ No newline at end of file +TIP: Of course, this is only the beginning of what you can do with variables in your tag. We created single variables here, but you can create pair variables and much more. For more information about this, and manipulating the tagdata in your plugin, check out the [Template Class](development/legacy/libraries/template.md). From f14a49dd1b043ed6f761d46ddce02d44970d0e33 Mon Sep 17 00:00:00 2001 From: Matt Johnson Date: Mon, 23 Jan 2023 11:51:04 -0600 Subject: [PATCH 07/13] Update extensions.md --- docs/development/extensions.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/development/extensions.md b/docs/development/extensions.md index 1a2964691..23281c0e4 100755 --- a/docs/development/extensions.md +++ b/docs/development/extensions.md @@ -12,7 +12,7 @@ lang: php --> # Extensions and Hooks -TIP: If your working with an existing add-on we recommend you start with [Modernizing add-ons](development/modernizing-existing-add-ons.md) +TIP: If you are working with an existing add-on, we recommend you start with [Modernizing add-ons](development/modernizing-existing-add-ons.md) [TOC] @@ -36,7 +36,7 @@ Extension hook created successfully! ``` -NOTE: If your using the command above to add an extention to an existing add-on, please see the [Updating Existing Add-ons](LINK GOES HERE) +NOTE: If you are using the command above to add an extention to an existing add-on, please see the [Updating Existing Add-ons](development/modernizing-existing-add-ons.md) TIP: Files that interact with ExpressionEngine core hooks are referred to as "extensions" because they extend the functionality of ExpressionEngine. @@ -187,4 +187,4 @@ There will be rather popular hooks being used by multiple extensions and some ho ### `ee()->extensions->end_script` -Many extension hooks exist for the express purpose of totally controlling a page or script in the Control Panel. They are meant for redesigning the appearance of a form or perhaps usurping a script for processing form data. In those instances you want your extension to be the last thing called for that extension hook so that nothing else is processed after that point. The `ee()->extensions->end_script` exists solely for that purpose. If you set this value to TRUE, then once your extension is done being processed the execution of the hook is finished, as is the script that the extension hook is contained within. \ No newline at end of file +Many extension hooks exist for the express purpose of totally controlling a page or script in the Control Panel. They are meant for redesigning the appearance of a form or perhaps usurping a script for processing form data. In those instances you want your extension to be the last thing called for that extension hook so that nothing else is processed after that point. The `ee()->extensions->end_script` exists solely for that purpose. If you set this value to TRUE, then once your extension is done being processed the execution of the hook is finished, as is the script that the extension hook is contained within. From 678cc7495f4c113d67df56296e6d4f6a64c18abb Mon Sep 17 00:00:00 2001 From: Matt Johnson Date: Mon, 23 Jan 2023 11:57:57 -0600 Subject: [PATCH 08/13] Update modernizing-existing-add-ons.md --- .../modernizing-existing-add-ons.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/development/modernizing-existing-add-ons.md b/docs/development/modernizing-existing-add-ons.md index 495af7a55..6a9e84689 100644 --- a/docs/development/modernizing-existing-add-ons.md +++ b/docs/development/modernizing-existing-add-ons.md @@ -11,21 +11,21 @@ -The ExpressionEngine 7.2 release brough a new add-on developemnt approach, which generates the majority of the add-ons needed files and struture. It also bring additional organization to how add-ons are developed. +The ExpressionEngine 7.2 release brought a new add-on development approach, which generates the majority of the add-on's needed files and structure. It also brings additional organization to how add-ons are developed. NOTE: These changes do NOT break existing add-ons. The old development methodologies will still work. -The idea of a plugin, module, extension, fieldtype, etc. no longer exist. Instead an add-on can have a template tag, or a field-type, or an extention. +The idea of a plugin, module, extension, fieldtype, etc. no longer exists. Instead, an add-on can have a template tag, a fieldtype, or an extension. -In order to harness the new add-on development methodology, you will have to do a few SMALL updates to your existing add-on's. +In order to harness the new add-on development methodology, you will have to do a few SMALL updates to your existing add-ons. -TIP: You don't have to migrate your add-on to the new development methodology. After making the following changes, you can leave your add-ons as is, and start new / additional development in the new method. +TIP: You don't have to migrate your add-on to the new development methodology. After making the following changes, you can leave your add-ons as is, and start new/additional development in the new method. [TOC] ## Updating your mod.addon.php file -In order to use the new approach, you will have to have your mod file use and extend the module addon service +In order to use the new approach, you will have to have your mod file use and extend the module add-on service ``` @@ -37,7 +37,7 @@ class Addon extends Module ## Updating your mcp.addon.php file -In order to use the new approach, you will have to have your mcp file use and extend the Mcp addon service +In order to use the new approach, you will have to have your mcp file use and extend the Mcp add-on service ``` use ExpressionEngine\Service\Addon\Mcp; @@ -47,7 +47,7 @@ class Addon_mcp extends Mcp ## Updating your ext.addon.php file -In order to use the new approach, you will have to have your mcp file use and extend the Extension addon service +In order to use the new approach, you will have to have your mcp file use and extend the Extension add-on service ``` use ExpressionEngine\Service\Addon\Extension; @@ -57,7 +57,7 @@ class Addon_ext extends Extension ## Updating your upd.addon.php file -In order to use the new approach, you will have to have your mcp file use and extend the Instaler addon service +In order to use the new approach, you will have to have your mcp file use and extend the Installer add-on service ``` use ExpressionEngine\Service\Addon\Installer; @@ -65,4 +65,4 @@ use ExpressionEngine\Service\Addon\Installer; class Addon_upd extends Installer ``` ## A Note on Plugins -If your add-on is currently a plugin and your 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. \ No newline at end of file +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. From 36ef10ffcf86e080493b2ecde37af22ee3d83b25 Mon Sep 17 00:00:00 2001 From: Matt Johnson Date: Mon, 23 Jan 2023 11:59:11 -0600 Subject: [PATCH 09/13] Update modernizing-existing-add-ons.md --- docs/development/modernizing-existing-add-ons.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/development/modernizing-existing-add-ons.md b/docs/development/modernizing-existing-add-ons.md index 6a9e84689..3e492160e 100644 --- a/docs/development/modernizing-existing-add-ons.md +++ b/docs/development/modernizing-existing-add-ons.md @@ -47,7 +47,7 @@ class Addon_mcp extends Mcp ## Updating your ext.addon.php file -In order to use the new approach, you will have to have your mcp file use and extend the Extension add-on service +In order to use the new approach, you will have to have your ext file use and extend the Extension add-on service ``` use ExpressionEngine\Service\Addon\Extension; @@ -57,7 +57,7 @@ class Addon_ext extends Extension ## Updating your upd.addon.php file -In order to use the new approach, you will have to have your mcp file use and extend the Installer add-on service +In order to use the new approach, you will have to have your upd file use and extend the Installer add-on service ``` use ExpressionEngine\Service\Addon\Installer; From e2232961c785d514b8b37c8bbbedf283e2539916 Mon Sep 17 00:00:00 2001 From: Matt Johnson Date: Mon, 23 Jan 2023 12:02:14 -0600 Subject: [PATCH 10/13] Update modernizing-existing-add-ons.md --- docs/development/modernizing-existing-add-ons.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/development/modernizing-existing-add-ons.md b/docs/development/modernizing-existing-add-ons.md index 3e492160e..2d31895d3 100644 --- a/docs/development/modernizing-existing-add-ons.md +++ b/docs/development/modernizing-existing-add-ons.md @@ -17,9 +17,8 @@ NOTE: These changes do NOT break existing add-ons. The old development methodol The idea of a plugin, module, extension, fieldtype, etc. no longer exists. Instead, an add-on can have a template tag, a fieldtype, or an extension. -In order to harness the new add-on development methodology, you will have to do a few SMALL updates to your existing add-ons. +To utilize the updated method for creating add-ons, you will need to make some small changes to your current add-ons. However, this does not mean that you need to completely convert your add-ons to the new method. After making these updates, you can continue using your existing add-ons and begin creating new ones using the updated method. -TIP: You don't have to migrate your add-on to the new development methodology. After making the following changes, you can leave your add-ons as is, and start new/additional development in the new method. [TOC] From ae8706088e0c5f610af7db520323bc94cddec380 Mon Sep 17 00:00:00 2001 From: Matt Johnson Date: Mon, 23 Jan 2023 12:07:40 -0600 Subject: [PATCH 11/13] Update modernizing-existing-add-ons.md --- docs/development/modernizing-existing-add-ons.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/development/modernizing-existing-add-ons.md b/docs/development/modernizing-existing-add-ons.md index 2d31895d3..8db2b2561 100644 --- a/docs/development/modernizing-existing-add-ons.md +++ b/docs/development/modernizing-existing-add-ons.md @@ -15,7 +15,7 @@ The ExpressionEngine 7.2 release brought a new add-on development approach, whic NOTE: These changes do NOT break existing add-ons. The old development methodologies will still work. -The idea of a plugin, module, extension, fieldtype, etc. no longer exists. Instead, an add-on can have a template tag, a fieldtype, or an extension. +The idea of an add-on _being_ a "plugin", "module", "extension", "fieldtype", etc. is no longer accurate. Instead, an add-on can include features such as template tags, actions, fieldtypes, or extensions. To utilize the updated method for creating add-ons, you will need to make some small changes to your current add-ons. However, this does not mean that you need to completely convert your add-ons to the new method. After making these updates, you can continue using your existing add-ons and begin creating new ones using the updated method. From 4a261ee0326782fed9b5ab5693bd73b65c8e62ad Mon Sep 17 00:00:00 2001 From: Tom Jaeger Date: Mon, 23 Jan 2023 14:02:14 -0500 Subject: [PATCH 12/13] add-on will require 7.2 once the changes are made --- docs/development/modernizing-existing-add-ons.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/development/modernizing-existing-add-ons.md b/docs/development/modernizing-existing-add-ons.md index 8db2b2561..05b44da43 100644 --- a/docs/development/modernizing-existing-add-ons.md +++ b/docs/development/modernizing-existing-add-ons.md @@ -3,7 +3,7 @@ ExpressionEngine User Guide (https://github.com/ExpressionEngine/ExpressionEngine-User-Guide) @link https://expressionengine.com/ - @copyright Copyright (c) 2003-2022, Packet Tide, LLC (https://packettide.com) + @copyright Copyright (c) 2003-2023, Packet Tide, LLC (https://packettide.com) @license https://expressionengine.com/license Licensed under Apache License, Version 2.0 --> @@ -13,7 +13,8 @@ The ExpressionEngine 7.2 release brought a new add-on development approach, which generates the majority of the add-on's needed files and structure. It also brings additional organization to how add-ons are developed. -NOTE: These changes do NOT break existing add-ons. The old development methodologies will still work. +NOTE: These changes do NOT break existing add-ons. The old development methodologies will still work. However once these changes are made the add-on will require ExpressionEngine 7.2+. + The idea of an add-on _being_ a "plugin", "module", "extension", "fieldtype", etc. is no longer accurate. Instead, an add-on can include features such as template tags, actions, fieldtypes, or extensions. From 109f2a73aaa1082e38c0c16131290b4c276b9ee4 Mon Sep 17 00:00:00 2001 From: Tom Jaeger Date: Mon, 23 Jan 2023 17:44:08 -0500 Subject: [PATCH 13/13] updated code exmaples to include private var add-on name... also updated example of auto upgrades to add-ons --- docs/development/automated-upgrading.md | 13 ++++++++++- .../modernizing-existing-add-ons.md | 22 +++++++++++++------ docs/toc_sections/_advanced_usage_toc.yml | 4 ++-- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/docs/development/automated-upgrading.md b/docs/development/automated-upgrading.md index 15778a688..4eeda8be5 100644 --- a/docs/development/automated-upgrading.md +++ b/docs/development/automated-upgrading.md @@ -34,9 +34,20 @@ class My_awesome_plugin_upgrade { } if(version_compare($version, '4.0.0', '=')) { - // Run updates for upgrade to EE3 + // Run updates for upgrade to EE4 + } + + if(version_compare($version, '5.0.0', '=')) { + // Run updates for upgrade to EE5 } + if(version_compare($version, '6.0.0', '=')) { + // Run updates for upgrade to EE6 + } + + if(version_compare($version, '7.0.0', '=')) { + // Run updates for upgrade to EE7 + } } } diff --git a/docs/development/modernizing-existing-add-ons.md b/docs/development/modernizing-existing-add-ons.md index 05b44da43..c8ff30b19 100644 --- a/docs/development/modernizing-existing-add-ons.md +++ b/docs/development/modernizing-existing-add-ons.md @@ -25,34 +25,41 @@ To utilize the updated method for creating add-ons, you will need to make some s [TOC] ## Updating your mod.addon.php file -In order to use the new approach, you will have to have your mod file use and extend the module add-on service +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 ``` use ExpressionEngine\Service\Addon\Module; -class Addon extends Module +class Amazing_add_on extends Module +{ + protected $addon_name = 'amazing_add_on'; ``` + ## Updating your mcp.addon.php file -In order to use the new approach, you will have to have your mcp file use and extend the Mcp add-on service +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 ``` use ExpressionEngine\Service\Addon\Mcp; -class Addon_mcp extends Mcp +class Amazing_add_on_mcp extends Mcp +{ + protected $addon_name = 'amazing_add_on'; ``` ## Updating your ext.addon.php file -In order to use the new approach, you will have to have your ext file use and extend the Extension add-on service +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 ``` use ExpressionEngine\Service\Addon\Extension; -class Addon_ext extends Extension +class Amazing_add_on_ext extends Extension +{ + protected $addon_name = 'amazing_add_on'; ``` ## 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 ``` use ExpressionEngine\Service\Addon\Installer; -class Addon_upd extends Installer +class Amazing_add_on_upd extends Installer +{ ``` ## A Note on Plugins 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. diff --git a/docs/toc_sections/_advanced_usage_toc.yml b/docs/toc_sections/_advanced_usage_toc.yml index e7a2151fc..7aa70b662 100644 --- a/docs/toc_sections/_advanced_usage_toc.yml +++ b/docs/toc_sections/_advanced_usage_toc.yml @@ -164,6 +164,8 @@ href: development/widgets.md #- name: REMOVE - Adding Text Formatting Options # href: development/text-formatting.md + - name: Modernizing add-ons + href: development/modernizing-existing-add-ons.md - name: Accessing the Database href: development/database-access.md @@ -612,8 +614,6 @@ href: development/guidelines/security.md - name: View Files and PHP Syntax href: development/guidelines/view-php-syntax.md - - name: Modernizing add-ons - href: development/modernizing-existing-add-ons.md - name: Debugging href: development/debugging.md - name: v3 Add-on Migration