I use this code in Joomla 3 component:
$dispatcher = \JEventDispatcher::getInstance();
if (class_exists('PlgSystemFields'))
{
//detach plugin
$dispatcher->detach('PlgSystemFields');
}
$return = $this->save2($data);
if (class_exists('PlgSystemFields'))
{
//register plugin
$dispatcher->register('', 'PlgSystemFields');
}
I disable the PlgSystemFields plugin for a moment in this code (::detach and ::register function). But in Joomla 4 is this not working. Joomla 4 replace the JEventDespatcher with the 'joomla/event' package. But where are these functions/methods gone?