Ejemplo n.º 1
0
 /**
  * @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()])]]];
 }
Ejemplo n.º 2
0
 /**
  * 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);
 }
Ejemplo n.º 3
0
 /**
  * @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);
 }