From c3f37e4f98eae3a84daa69415c64cac0394351bb Mon Sep 17 00:00:00 2001 From: Shankar Konar Date: Tue, 24 Mar 2020 10:29:16 +0530 Subject: [PATCH 1/2] Plugin information added in plugin template --- .../code/Magento Plugin After Method.html | 4 -- .../code/Magento Plugin After Method.php.html | 42 +++++++++++++++++++ .../code/Magento Plugin Around Method.html | 4 -- .../Magento Plugin Around Method.php.html | 42 +++++++++++++++++++ .../code/Magento Plugin Before Method.html | 4 -- .../Magento Plugin Before Method.php.html | 42 +++++++++++++++++++ 6 files changed, 126 insertions(+), 12 deletions(-) delete mode 100644 resources/fileTemplates/code/Magento Plugin After Method.html create mode 100644 resources/fileTemplates/code/Magento Plugin After Method.php.html delete mode 100644 resources/fileTemplates/code/Magento Plugin Around Method.html create mode 100644 resources/fileTemplates/code/Magento Plugin Around Method.php.html delete mode 100644 resources/fileTemplates/code/Magento Plugin Before Method.html create mode 100644 resources/fileTemplates/code/Magento Plugin Before Method.php.html diff --git a/resources/fileTemplates/code/Magento Plugin After Method.html b/resources/fileTemplates/code/Magento Plugin After Method.html deleted file mode 100644 index 7879e1ce9..000000000 --- a/resources/fileTemplates/code/Magento Plugin After Method.html +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/resources/fileTemplates/code/Magento Plugin After Method.php.html b/resources/fileTemplates/code/Magento Plugin After Method.php.html new file mode 100644 index 000000000..1b02f9d5a --- /dev/null +++ b/resources/fileTemplates/code/Magento Plugin After Method.php.html @@ -0,0 +1,42 @@ + + + + + + +
Magento runs all after methods following the completion of the observed method. + Magento requires these methods have a return value and they must have the same name as the observed method with ‘after’ as the prefix. +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Predefined variables will take the following values:
${TYPE_NAME} A class or interface which the plugin observes.
${PLUGIN_NAME} An arbitrary plugin name that identifies a plugin. Also used to merge the configurations for the plugin.
${PLUGIN_TYPE} The name of a plugin’s class or its virtual type. Use the following naming convention when you specify this element: \Vendor\Module\Plugin\ClassName
${PLUGIN_SORTORDER} Plugins that call the same method run them using this order.
${PLUGIN_DISABLED} To disable a plugin, set this element to true. The default value is false.
+ + diff --git a/resources/fileTemplates/code/Magento Plugin Around Method.html b/resources/fileTemplates/code/Magento Plugin Around Method.html deleted file mode 100644 index 6bfc7988e..000000000 --- a/resources/fileTemplates/code/Magento Plugin Around Method.html +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/resources/fileTemplates/code/Magento Plugin Around Method.php.html b/resources/fileTemplates/code/Magento Plugin Around Method.php.html new file mode 100644 index 000000000..68b37c700 --- /dev/null +++ b/resources/fileTemplates/code/Magento Plugin Around Method.php.html @@ -0,0 +1,42 @@ + + + + + + +
Magento runs the code in around methods before and after their observed methods. + Using these methods allow you to override an observed method. Around methods must have the same name as the observed method with ‘around’ as the prefix. +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Predefined variables will take the following values:
${TYPE_NAME} A class or interface which the plugin observes.
${PLUGIN_NAME} An arbitrary plugin name that identifies a plugin. Also used to merge the configurations for the plugin.
${PLUGIN_TYPE} The name of a plugin’s class or its virtual type. Use the following naming convention when you specify this element: \Vendor\Module\Plugin\ClassName
${PLUGIN_SORTORDER} Plugins that call the same method run them using this order.
${PLUGIN_DISABLED} To disable a plugin, set this element to true. The default value is false.
+ + diff --git a/resources/fileTemplates/code/Magento Plugin Before Method.html b/resources/fileTemplates/code/Magento Plugin Before Method.html deleted file mode 100644 index 6bfc7988e..000000000 --- a/resources/fileTemplates/code/Magento Plugin Before Method.html +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/resources/fileTemplates/code/Magento Plugin Before Method.php.html b/resources/fileTemplates/code/Magento Plugin Before Method.php.html new file mode 100644 index 000000000..1b63210fb --- /dev/null +++ b/resources/fileTemplates/code/Magento Plugin Before Method.php.html @@ -0,0 +1,42 @@ + + + + + + +
Magento runs all before methods ahead of the call to an observed method. + These methods must have the same name as the observed method with ‘before’ as the prefix. +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Predefined variables will take the following values:
${TYPE_NAME} A class or interface which the plugin observes.
${PLUGIN_NAME} An arbitrary plugin name that identifies a plugin. Also used to merge the configurations for the plugin.
${PLUGIN_TYPE} The name of a plugin’s class or its virtual type. Use the following naming convention when you specify this element: \Vendor\Module\Plugin\ClassName
${PLUGIN_SORTORDER} Plugins that call the same method run them using this order.
${PLUGIN_DISABLED} To disable a plugin, set this element to true. The default value is false.
+ + From 16a153b0a6922d3008f5348ff495ebda014a42f5 Mon Sep 17 00:00:00 2001 From: Shankar Konar Date: Tue, 24 Mar 2020 12:44:20 +0530 Subject: [PATCH 2/2] Code review changes --- .../code/Magento Plugin After Method.php.html | 21 +++++++------------ .../Magento Plugin Around Method.php.html | 21 +++++++------------ .../Magento Plugin Before Method.php.html | 21 +++++++------------ 3 files changed, 24 insertions(+), 39 deletions(-) diff --git a/resources/fileTemplates/code/Magento Plugin After Method.php.html b/resources/fileTemplates/code/Magento Plugin After Method.php.html index 1b02f9d5a..441ec06bf 100644 --- a/resources/fileTemplates/code/Magento Plugin After Method.php.html +++ b/resources/fileTemplates/code/Magento Plugin After Method.php.html @@ -13,29 +13,24 @@ Predefined variables will take the following values: - ${TYPE_NAME} + ${PARAM_DOC}   - A class or interface which the plugin observes. + PHP DocBlock for plugin function - ${PLUGIN_NAME} + ${NAME}   - An arbitrary plugin name that identifies a plugin. Also used to merge the configurations for the plugin. + Name of the plugin function - ${PLUGIN_TYPE} + ${PARAM_LIST}   - The name of a plugin’s class or its virtual type. Use the following naming convention when you specify this element: \Vendor\Module\Plugin\ClassName + List of plugin function parameters - ${PLUGIN_SORTORDER} + ${RETURN_VARIABLES}   - Plugins that call the same method run them using this order. - - - ${PLUGIN_DISABLED} -   - To disable a plugin, set this element to true. The default value is false. + Return value for plugin function diff --git a/resources/fileTemplates/code/Magento Plugin Around Method.php.html b/resources/fileTemplates/code/Magento Plugin Around Method.php.html index 68b37c700..6fce54b9c 100644 --- a/resources/fileTemplates/code/Magento Plugin Around Method.php.html +++ b/resources/fileTemplates/code/Magento Plugin Around Method.php.html @@ -13,29 +13,24 @@ Predefined variables will take the following values: - ${TYPE_NAME} + ${PARAM_DOC}   - A class or interface which the plugin observes. + PHP DocBlock for plugin function - ${PLUGIN_NAME} + ${NAME}   - An arbitrary plugin name that identifies a plugin. Also used to merge the configurations for the plugin. + Name of the plugin function - ${PLUGIN_TYPE} + ${PARAM_LIST}   - The name of a plugin’s class or its virtual type. Use the following naming convention when you specify this element: \Vendor\Module\Plugin\ClassName + List of plugin function parameters - ${PLUGIN_SORTORDER} + ${RETURN_VARIABLES}   - Plugins that call the same method run them using this order. - - - ${PLUGIN_DISABLED} -   - To disable a plugin, set this element to true. The default value is false. + Return value for plugin function diff --git a/resources/fileTemplates/code/Magento Plugin Before Method.php.html b/resources/fileTemplates/code/Magento Plugin Before Method.php.html index 1b63210fb..d3536bbb7 100644 --- a/resources/fileTemplates/code/Magento Plugin Before Method.php.html +++ b/resources/fileTemplates/code/Magento Plugin Before Method.php.html @@ -13,29 +13,24 @@ Predefined variables will take the following values: - ${TYPE_NAME} + ${PARAM_DOC}   - A class or interface which the plugin observes. + PHP DocBlock for plugin function - ${PLUGIN_NAME} + ${NAME}   - An arbitrary plugin name that identifies a plugin. Also used to merge the configurations for the plugin. + Name of the plugin function - ${PLUGIN_TYPE} + ${PARAM_LIST}   - The name of a plugin’s class or its virtual type. Use the following naming convention when you specify this element: \Vendor\Module\Plugin\ClassName + List of plugin function parameters - ${PLUGIN_SORTORDER} + ${RETURN_VARIABLES}   - Plugins that call the same method run them using this order. - - - ${PLUGIN_DISABLED} -   - To disable a plugin, set this element to true. The default value is false. + Return value for plugin function