Call JPluginHelper::importPlugin() with two unique instances of JEventDispatcher class:
$type = 'quickicon';
$dispatcher1 = new JEventDispatcher();
$dispatcher2 = new JEventDispatcher();
JPluginHelper::importPlugin($type, null, true, $dispatcher1);
JPluginHelper::importPlugin($type, null, true, $dispatcher2);
echo "<p>Dispatcher1:</p>"; ##
echo "<pre>"; ##
print_r($dispatcher1); ##
echo "</pre>"; ##
echo "<p>Dispatcher2:</p>"; ##
echo "<pre>"; ##
print_r($dispatcher2); ##
echo "</pre>"; ##
Both dispatchers should be identical, with plugins loaded as observers:
Dispatcher1:
JEventDispatcher Object
(
[_observers:protected] => Array
(
[0] => PlgQuickiconJoomlaupdate Object
(
[autoloadLanguage:protected] => 1
[params] => Joomla\Registry\Registry Object
(
[data:protected] => stdClass Object
(
)
[initialized:protected] => 1
[separator] => .
)
[_name:protected] => joomlaupdate
[_type:protected] => quickicon
[_subject:protected] => JEventDispatcher Object
*RECURSION*
[_errors:protected] => Array
(
)
)
[1] => PlgQuickiconExtensionupdate Object
(
[autoloadLanguage:protected] => 1
[params] => Joomla\Registry\Registry Object
(
[data:protected] => stdClass Object
(
)
[initialized:protected] => 1
[separator] => .
)
[_name:protected] => extensionupdate
[_type:protected] => quickicon
[_subject:protected] => JEventDispatcher Object
*RECURSION*
[_errors:protected] => Array
(
)
)
)
[_state:protected] =>
[_methods:protected] => Array
(
[ongeticons] => Array
(
[0] => 0
[1] => 1
)
)
[_errors:protected] => Array
(
)
)
Dispatcher2:
JEventDispatcher Object
(
[_observers:protected] => Array
(
[0] => PlgQuickiconJoomlaupdate Object
(
[autoloadLanguage:protected] => 1
[params] => Joomla\Registry\Registry Object
(
[data:protected] => stdClass Object
(
)
[initialized:protected] => 1
[separator] => .
)
[_name:protected] => joomlaupdate
[_type:protected] => quickicon
[_subject:protected] => JEventDispatcher Object
*RECURSION*
[_errors:protected] => Array
(
)
)
[1] => PlgQuickiconExtensionupdate Object
(
[autoloadLanguage:protected] => 1
[params] => Joomla\Registry\Registry Object
(
[data:protected] => stdClass Object
(
)
[initialized:protected] => 1
[separator] => .
)
[_name:protected] => extensionupdate
[_type:protected] => quickicon
[_subject:protected] => JEventDispatcher Object
*RECURSION*
[_errors:protected] => Array
(
)
)
)
[_state:protected] =>
[_methods:protected] => Array
(
[ongeticons] => Array
(
[0] => 0
[1] => 1
)
)
[_errors:protected] => Array
(
)
)
Second dispatcher has no observers loaded:
Dispatcher1:
JEventDispatcher Object
(
[_observers:protected] => Array
(
[0] => PlgQuickiconJoomlaupdate Object
(
[autoloadLanguage:protected] => 1
[params] => Joomla\Registry\Registry Object
(
[data:protected] => stdClass Object
(
)
[initialized:protected] => 1
[separator] => .
)
[_name:protected] => joomlaupdate
[_type:protected] => quickicon
[_subject:protected] => JEventDispatcher Object
*RECURSION*
[_errors:protected] => Array
(
)
)
[1] => PlgQuickiconExtensionupdate Object
(
[autoloadLanguage:protected] => 1
[params] => Joomla\Registry\Registry Object
(
[data:protected] => stdClass Object
(
)
[initialized:protected] => 1
[separator] => .
)
[_name:protected] => extensionupdate
[_type:protected] => quickicon
[_subject:protected] => JEventDispatcher Object
*RECURSION*
[_errors:protected] => Array
(
)
)
)
[_state:protected] =>
[_methods:protected] => Array
(
[ongeticons] => Array
(
[0] => 0
[1] => 1
)
)
[_errors:protected] => Array
(
)
)
Dispatcher2:
JEventDispatcher Object
(
[_observers:protected] => Array
(
)
[_state:protected] =>
[_methods:protected] => Array
(
)
[_errors:protected] => Array
(
)
)
Platform Windows NT KEY 6.1 build 7601 (Windows 7 Business Edition Service Pack 1) i586
DB 5.5.38-log
DB encoding utf8_general_ci
DB connection encoding utf8mb4_general_ci
PHP version 5.4.29
Web-server Apache/2.2.27 (Win32)
apache2handler
Joomla! 3.6.4 Stable [ Noether ] 21-October-2016 16:33 GMT
Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
User agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0
The ability to load the plugin with individual dispatchers is important when dealing with extension-specific plugins. It is the way to run the plugins from the specific plugin group(s) in isolation from the "system-wide" plugins.
Status | New | ⇒ | Information Required |
@franz-wohlkoenig I'm not sure if I've got your question right, but if you are talking about Joomla! 3.6.5, sorry, I didn't have a chance to check yet.
@iv660 3.6.5 or https://github.com/joomla/joomla-cms/tree/staging the staging branch
but it is still the same behavior on staging (just checked) using your code above.
To fix this, the static loaded array is going to need to become an associative array with the key being a hash of the injected dispatcher (or whatever the default one is when the param is null) and it holds an array of the loaded plugins for that dispatcher.
Status | Information Required | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-04-27 01:32:35 |
Closed_By | ⇒ | mbabker |
@iv660 is this Issue on latest Staging too?
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12690.