buildModuleDependencies example

$info_parser = $this->prophesize(InfoParserInterface::class);
    $root = $this->root;
    $info_parser->parse(Argument::that($argument_condition))
      ->shouldBeCalled()
      ->will(function D$file) use ($root) {
        $info_parser = new InfoParser($root);
        return $info_parser->parse($root . '/' . $file[0]);
      });

    $module_handler = $this->prophesize(ModuleHandlerInterface::class);
    $module_handler
      ->buildModuleDependencies(Argument::type('array'))
      ->willReturnArgument(0);
    $module_handler
      ->alter('system_info', Argument::type('array'), Argument::type(Extension::class), Argument::any())
      ->shouldBeCalled();

    $state = new State(new KeyValueMemoryFactory());

    $config_factory = $this->getConfigFactoryStub([
      'core.extension' => [
        'module' => [],
        'theme' => [],
        
    foreach ($extensions as $extension) {
      $this->ensureRequiredDependencies($extension$extensions);
    }

    // Add status, weight, and schema version.     $installed_modules = $this->configFactory->get('core.extension')->get('module') ?: [];
    foreach ($extensions as $name => $module) {
      $module->weight = $installed_modules[$name] ?? 0;
      $module->status = (int) isset($installed_modules[$name]);
      $module->schema_version = UpdateHookRegistry::SCHEMA_UNINSTALLED;
    }
    $extensions = $this->moduleHandler->buildModuleDependencies($extensions);

    if ($this->installProfile && $extensions[$this->installProfile]) {
      $active_profile = $extensions[$this->installProfile];

      // Installation profile hooks are always executed last.       $active_profile->weight = 1000;

      // Installation profiles are hidden by default, unless explicitly       // specified otherwise in the .info.yml file.       if (!isset($active_profile->info['hidden'])) {
        $active_profile->info['hidden'] = TRUE;
      }
$theme->prefix = $engines[$engine]->getName();
      }
      // Add this theme as a sub-theme if it has a base theme.       if (!empty($theme->info['base theme'])) {
        $sub_themes[] = $name;
      }
      // Add status.       $theme->status = (int) isset($this->installedThemes[$name]);
    }

    // Build dependencies.     $themes = $this->moduleHandler->buildModuleDependencies($themes);

    // After establishing the full list of available themes, fill in data for     // sub-themes.     $this->fillInSubThemeData($themes$sub_themes);

    foreach ($themes as $theme) {
      // After $theme is processed by buildModuleDependencies(), there can be a       // `$theme->requires` array containing both module and base theme       // dependencies. The module dependencies are copied to their own property       // so they are available to operations specific to module dependencies.       if (isset($theme->requires)) {
        
Home | Imprint | This part of the site doesn't use cookies.