/** * 주어진 플러그인에 포함된 component를 register에 등록한다. * * @param PluginEntity $entity 플러그인 * * @return void */ public function addByEntity(PluginEntity $entity) { $componentList = $entity->getComponentList(); foreach ($componentList as $id => $info) { $info['id'] = $id; $this->setComponentInfo($info); $this->add($info['class']); } }
/** * 플러그인의 view namespace를 지정한다. * * @param PluginEntity $entity 플러그인 * * @return void */ private function registerViewNamespace(PluginEntity $entity) { $this->viewFactory->addNamespace($entity->getId(), $this->pluginsDir . '/' . $entity->getId()); }
/** * @depends testConstruct * * @param \Xpressengine\Plugin\PluginEntity $entity */ public function testGetters($entity) { $this->assertEquals('title', $entity->getTitle()); $this->assertEquals(__DIR__ . '/plugins/plugin_sample', $entity->getPath()); $this->assertEquals('khongchi plugin.', $entity->getDescription()); $this->assertCount(6, $entity->getSupport()); $this->assertEquals('khongchi/plugin_sample', $entity->getName()); $this->assertEquals(['xpressengine', 'board'], $entity->getKeywords()); $this->assertEquals('khongchi', $entity->getAuthors()[0]['name']); $this->assertEquals('LGPL-2.0', $entity->getLicense()); }
/** * getSkinFile * * @param PluginEntity $plugin * @param $path * @param $skinClass * * @return array|string * @throws \Exception */ protected function getSkinFile(PluginEntity $plugin, $path, $skinClass) { $path = $path . "/{$skinClass}.php"; if (file_exists($plugin->getPath($path))) { throw new \Exception("file[{$path}] already exists."); } return $path; }