1
1
<?php
2
2
3
3
declare (strict_types=1 );
4
- /**
5
- * Zikula Application Framework
4
+
5
+ /*
6
+ * This file is part of the Zikula package.
7
+ *
8
+ * Copyright Zikula Foundation - https://ziku.la/
6
9
*
7
- * @copyright (c) Zikula Development Team
8
- * @see https://ziku.la
9
- * @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
10
12
*/
11
13
12
14
namespace Zikula \ScribiteModule \Editor \CKEditor \Collection ;
13
15
16
+ use Zikula \ScribiteModule \Editor \EditorPluginCollectionInterface ;
17
+
14
18
/**
15
- * This class is used as the subject of the event 'moduleplugin.ckeditor.externalplugins' .
16
- * Any module that needs to add *external* editor plugins can use an event listener to automatically load their
19
+ * This class is used by the `Zikula\ScribiteModule\Editor\CKEditor\LoadExternalPluginsEvent` .
20
+ * Any extension that needs to add *external* editor plugins can use an event listener to automatically load their
17
21
* helper every time a Scribite editor is loaded.
18
22
* @see http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.resourceManager.html#addExternal
19
23
* @see http://ckeditor.com/comment/47922#comment-47922
20
24
*/
21
- class PluginCollection
25
+ class PluginCollection implements EditorPluginCollectionInterface
22
26
{
23
27
/**
24
- * stack of plugins
25
- * @var array
28
+ * Stack of plugins.
26
29
*/
27
- private $ plugins ;
28
-
29
- /**
30
- * PluginCollection constructor.
31
- */
32
- public function __construct ()
33
- {
34
- $ this ->plugins = [];
35
- }
30
+ private $ plugins = [];
36
31
37
32
/**
38
- * add a plugin to the stack
39
- * @param array $plugin
40
- * $helper must have array keys [name, path, file, img] set
33
+ * Adds a plugin to the stack.
34
+ *
35
+ * $plugin must have array keys [name, path, file, img] set.
41
36
*/
42
- public function add (array $ plugin )
37
+ public function add (array $ plugin ): void
43
38
{
44
39
if (isset ($ plugin ['name ' ], $ plugin ['path ' ], $ plugin ['file ' ], $ plugin ['img ' ])) {
45
40
$ plugin ['path ' ] = rtrim ($ plugin ['path ' ], '/ ' ) . '/ ' ; // ensure there is a trailing slash
@@ -48,10 +43,9 @@ public function add(array $plugin)
48
43
}
49
44
50
45
/**
51
- * get the helper stack
52
- * @return array
46
+ * Gets the plugins stack.
53
47
*/
54
- public function getPlugins ()
48
+ public function getPlugins (): array
55
49
{
56
50
return $ this ->plugins ;
57
51
}
0 commit comments