/** * @param ModuleInterface $module * @return array */ public function transform(ModuleInterface $module) { return ['key' => $module->getKey(), 'name' => $module->getName(), 'version' => $module->getVersion(), 'class' => $module->getAssociatedClass(), 'links' => [['rel' => 'self', 'uri' => cms()->apiRoute('modules.show', [$module->getKey()])]]]; }
/** * Returns the group a module is assigned to in the configuration, if any. * * @param ModuleInterface $module * @return bool */ protected function getConfiguredModuleGroupKey(ModuleInterface $module) { if (!array_key_exists($module->getKey(), $this->configMenuModels)) { return false; } // If the module config value is not an array, it is interpreted as the group key if (!is_array($this->configMenuModels[$module->getKey()])) { return $this->configMenuModels[$module->getKey()]; } return array_get($this->configMenuModels[$module->getKey()], 'group', false); }
/** * @param ModuleInterface $module */ protected function storeModule(ModuleInterface $module) { if ($this->modules->has($module->getKey())) { throw new \UnexpectedValueException("Module with key '{$module->getKey()}' already registered!"); } $this->modules->put($module->getKey(), $module); }