/** * @param Container $container * @param \Enlight_Loader $loader * @param \Enlight_Event_EventManager $eventManager * @param \Shopware $application * @param array $config * @return \Enlight_Plugin_PluginManager */ public function factory(Container $container, \Enlight_Loader $loader, \Enlight_Event_EventManager $eventManager, \Shopware $application, array $config) { $pluginManager = new \Enlight_Plugin_PluginManager($application); $container->load('Table'); if (!isset($config['namespaces'])) { $config['namespaces'] = array('Core', 'Frontend', 'Backend'); } foreach ($config['namespaces'] as $namespace) { $namespace = new \Shopware_Components_Plugin_Namespace($namespace); $pluginManager->registerNamespace($namespace); $eventManager->registerSubscriber($namespace->Subscriber()); } foreach (array('Local', 'Community', 'Default', 'Commercial') as $dir) { $loader->registerNamespace('Shopware_Plugins', Shopware()->AppPath('Plugins_' . $dir)); } return $pluginManager; }
/** * @return void */ public function start() { $this->eventManager->registerSubscriber($this->getListeners()); }
/** * @param Enlight_Event_Subscriber $subscriber */ public function registerSubscriber(Enlight_Event_Subscriber $subscriber) { $this->events->registerSubscriber($subscriber); }