From d57f35fc006ce1dc189bf5af30358e6cf2e8891c Mon Sep 17 00:00:00 2001 From: saman222 Date: Wed, 23 Feb 2022 13:31:56 +0330 Subject: [PATCH] correct the name of the editors-xtd group plugins class editors-xtd group plugins class name must have a (plgButton) structure, but JCB creates the names of these classes with (plg) structure, which makes this type of plugins not work --- admin/helpers/compiler/a_Get.php | 4 +--- admin/helpers/componentbuilder.php | 18 ++++++++++++++++-- site/helpers/componentbuilder.php | 17 ++++++++++++++++- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index b4a0377f1..5e9a411b9 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -10149,9 +10149,7 @@ class Get // set lang prefix $plugin->lang_prefix = $this->langPrefix; // set plugin class name - $plugin->class_name = 'Plg' . ucfirst($plugin->group) . ucfirst( - $plugin->code_name - ); + $plugin->class_name = ComponentbuilderHelper::createPluginClassName($plugin->group, $plugin->code_name); // set plugin install class name $plugin->installer_class_name = 'plg' . ucfirst($plugin->group) . ucfirst($plugin->code_name) . 'InstallerScript'; diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php index 99c85408c..49fa4b2b0 100644 --- a/admin/helpers/componentbuilder.php +++ b/admin/helpers/componentbuilder.php @@ -6587,8 +6587,22 @@ abstract class ComponentbuilderHelper return array_values($fieldIds); } return false; - } - + } + + /** + * create plugin class name + */ + public static function createPluginClassName($group, $code_name) + { + // editors-xtd group plugins must have a class with plgButton structure + if ($group == 'editors-xtd') + $group= 'Button'; + + return 'Plg' . ucfirst($group) . ucfirst( + $code_name + ); + } + /** * get a plugin fields IDs */ diff --git a/site/helpers/componentbuilder.php b/site/helpers/componentbuilder.php index fb6062b96..b5e0291dc 100644 --- a/site/helpers/componentbuilder.php +++ b/site/helpers/componentbuilder.php @@ -6622,7 +6622,22 @@ abstract class ComponentbuilderHelper return array_values($fieldIds); } return false; - } + } + + + /** + * create plugin class name + */ + public static function createPluginClassName($group, $code_name) + { + // editors-xtd group plugins must have a class with plgButton structure + if ($group == 'editors-xtd') + $group= 'Button'; + + return 'Plg' . ucfirst($group) . ucfirst( + $code_name + ); + } /** * get an admin view fields IDs