I'm trying to import Joomla in a Yii application. It goes well, but some plugins and libraries are not loaded. Does anyone know how to achieve this? Something like
JPluginHelper::loadAllActivePlugins();
This is my code so far:
define('_JEXEC', 1);
$joomlaRootFolder = \Yii::$app->params['joomlaRootFolder'];
if (file_exists($joomlaRootFolder . '/defines.php')) {
include_once $joomlaRootFolder . '/defines.php';
}
if (!defined('_JDEFINES')) {
define('JPATH_BASE', $joomlaRootFolder);
require_once JPATH_BASE . '/includes/defines.php';
}
require_once JPATH_BASE . '/includes/framework.php';
// Instantiate the application.
$app = \JFactory::getApplication('site');
$app->initialise();
// Breaks here!
\MyGlobalLibrary::didNotFindClass();
The library works as expected in our Joomla code, so that's not the problem.
Edit: My solution was to manually call
\JPluginHelper::importPlugin('system');
\JEventDispatcher::getInstance()->trigger('onAfterInitialise');
Seems like this was not done in the $app->initialise()
method.