/** * Helper function to build the path to the passed plugin. * @param Plugin $plugin * @return string */ public function getPluginPath(Plugin $plugin) { $namespace = strtolower($plugin->getNamespace()); $source = strtolower($plugin->getSource()); $name = $plugin->getName(); return $this->rootDir . DIRECTORY_SEPARATOR . 'engine' . DIRECTORY_SEPARATOR . 'Shopware' . DIRECTORY_SEPARATOR . 'Plugins' . DIRECTORY_SEPARATOR . ucfirst($source) . DIRECTORY_SEPARATOR . ucfirst($namespace) . DIRECTORY_SEPARATOR . ucfirst($name); }
/** * Returns a certain plugin by plugin id. * * @param \Shopware\Models\Plugin\Plugin $plugin * @return Shopware_Components_Plugin_Bootstrap|null */ public function getPluginBootstrap($plugin) { $namespace = Shopware()->Plugins()->get($plugin->getNamespace()); if ($namespace === null) { return null; } $plugin = $namespace->get($plugin->getName()); return $plugin; }
/** * @param Plugin $plugin * @param Shop $shop * @return array */ public function getPluginConfig(Plugin $plugin, Shop $shop = null) { $namespace = $this->plugins->get($plugin->getNamespace()); /** @var \Shopware_Components_Plugin_Namespace $namespace */ $config = $namespace->getConfig($plugin->getName(), $shop); return $config->toArray(); }