플러그인이 소유한 컴포넌트 목록을 조회한다. type이 지정돼 있을 경우 해당 type의 컴포넌트를 조회한다.
public getComponentList ( string $type = null ) : array | ||
$type | string | component type |
return | array |
/** * 주어진 플러그인에 포함된 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']); } }
/** * @depends testConstruct * * @param \Xpressengine\Plugin\PluginEntity $entity */ public function testGetComponentList($entity) { $components = $entity->getComponentList(); $this->assertEquals('게시판', $components['module/board']['name']); $modules = $entity->getComponentList('module'); $this->assertCount(2, $modules); }