private function initAddon($addon)
{
$base_path = $this->pathfinder->base_location->getPath();
$init_class_path = $base_path . '/../' . $addon->get('addon_full_path') . '/lib/Initiator.php';
if (file_exists($init_class_path)) {
include $init_class_path;
$class_name = str_replace('/', '\\', $addon->get('name') . '\\Initiator');
/** @type Controller_Addon $init */
$init = $this->add($class_name, array('addon_obj' => $addon, 'base_path' => $base_path));
if (!is_a($init, 'Controller_Addon')) {
throw $this->exception('Initiator of ' . $addon->get('name') . ' is inherited not from \\Controller_Addon');
}
/*
* initiators of all addons are accessible
* from all around the project
* through $this->app->getInitiatedAddons()
*/
$this->addons[$init->api_var] = $init;
if ($init->with_pages) {
$init->routePages($init->api_var);
}
}
}