public function getComponentList($type = null)
{
$componentList = $this->getMetaData('extra.xpressengine.component');
if ($componentList === null) {
$componentList = [];
}
if ($type === null) {
return $componentList;
} else {
$componentsFetched = [];
array_walk($componentList, function ($info, $key) use(&$componentsFetched, $type) {
$componentType = $this->getComponentType($key);
if ($componentType === $type) {
$componentsFetched[$key] = $info;
}
});
return $componentsFetched;
}
}