From 4855062308e1554248e726eb649aae441d3934d8 Mon Sep 17 00:00:00 2001 From: Brian Hanson Date: Wed, 11 Mar 2026 08:21:11 -0500 Subject: [PATCH 1/3] Make sure we only register packages once --- src/helpers/CkeditorConfig.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers/CkeditorConfig.php b/src/helpers/CkeditorConfig.php index b739b586..90c89bd0 100644 --- a/src/helpers/CkeditorConfig.php +++ b/src/helpers/CkeditorConfig.php @@ -217,7 +217,7 @@ public static function registerPackage(string $name, array $config): void if (!isset(self::$pluginsByPackage[$name])) { self::$pluginsByPackage[$name] = $plugins; } else { - self::$pluginsByPackage[$name] = array_merge(self::$pluginsByPackage[$name], $plugins); + self::$pluginsByPackage[$name] = array_unique(array_merge(self::$pluginsByPackage[$name], $plugins)); } self::$toolbarItems[] = $toolbarItems; From fe9f8a8b4beebd5a3919539dce47f86a9ca399cd Mon Sep 17 00:00:00 2001 From: Brian Hanson Date: Wed, 11 Mar 2026 08:42:51 -0500 Subject: [PATCH 2/3] Just overwrite the array all the time --- src/helpers/CkeditorConfig.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/helpers/CkeditorConfig.php b/src/helpers/CkeditorConfig.php index 90c89bd0..6e25b1f2 100644 --- a/src/helpers/CkeditorConfig.php +++ b/src/helpers/CkeditorConfig.php @@ -214,12 +214,7 @@ public static function registerPackage(string $name, array $config): void $plugins = $config['plugins'] ?? []; $toolbarItems = $config['toolbarItems'] ?? []; - if (!isset(self::$pluginsByPackage[$name])) { - self::$pluginsByPackage[$name] = $plugins; - } else { - self::$pluginsByPackage[$name] = array_unique(array_merge(self::$pluginsByPackage[$name], $plugins)); - } - + self::$pluginsByPackage[$name] = $plugins; self::$toolbarItems[] = $toolbarItems; self::$pluginButtonMap[] = [ 'plugins' => $plugins, From 977b9b851edcd6d194c9df3c8d844764d8abb430 Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Thu, 12 Mar 2026 09:25:07 -0700 Subject: [PATCH 3/3] Release note [ci skip] --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0578a3f0..4d6c757f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Fixed a bug where custom `toolbar` config settings were getting ignored. ([#522](https://github.com/craftcms/ckeditor/issues/522)) - Fixed a bug where files uploaded to Assets fields could also be added to nearby CKEditor fields. ([#523](https://github.com/craftcms/ckeditor/issues/523)) +- Fixed an error that could occur when registering a custom CKEditor plugin. ([#525](https://github.com/craftcms/ckeditor/issues/525)) ## 5.1.0 - 2026-03-05