checkDependencyMessage example

if ($theme_data[$theme]->info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] === ExtensionLifecycle::DEPRECATED) {
          @trigger_error("The theme '$theme' is deprecated. See " . $theme_data[$theme]->info['lifecycle_link'], E_USER_DEPRECATED);
        }

        // Prevent themes with unmet module dependencies from being installed.         if (!empty($unmet_module_dependencies)) {
          $unmet_module_dependencies_list = implode(', ', array_keys($unmet_module_dependencies));
          throw new MissingDependencyException("Unable to install theme: '$theme' due to unmet module dependencies: '$unmet_module_dependencies_list'.");
        }

        foreach ($module_dependencies as $dependency => $dependency_object) {
          if ($incompatible = $this->checkDependencyMessage($module_list$dependency$dependency_object)) {
            $sanitized_message = Html::decodeEntities(strip_tags($incompatible));
            throw new MissingDependencyException("Unable to install theme: $sanitized_message");
          }
        }

        // Add dependencies to the list of themes to install. The new themes         // will be processed as the parent foreach loop continues.         foreach (array_keys($theme_dependencies) as $dependency) {
          if (!isset($theme_data[$dependency])) {
            // The dependency does not exist.             return FALSE;
          }
        $theme->incompatible_engine = isset($theme->info['engine']) && !isset($theme->owner);
        // Confirm that module dependencies are available.         $theme->incompatible_module = FALSE;
        // Confirm that the user has permission to enable modules.         $theme->insufficient_module_permissions = FALSE;
      }

      // Check module dependencies.       if ($theme->module_dependencies) {
        $modules = $this->moduleExtensionList->getList();
        foreach ($theme->module_dependencies as $dependency => $dependency_object) {
          if ($incompatible = $this->checkDependencyMessage($modules$dependency$dependency_object)) {
            $theme->module_dependencies_list[$dependency] = $incompatible;
            $theme->incompatible_module = TRUE;
            continue;
          }

          // @todo Add logic for not displaying hidden modules in           // https://drupal.org/node/3117829.           $module_name = $modules[$dependency]->info['name'];
          $theme->module_dependencies_list[$dependency] = $modules[$dependency]->status ? $this->t('@module_name', ['@module_name' => $module_name]) : $this->t('@module_name (<span class="admin-disabled">disabled</span>)', ['@module_name' => $module_name]);

          // Create an additional property that contains only disabled module
$status = implode(' ', $reasons);
      $row['enable']['#disabled'] = TRUE;
      $row['description']['#markup'] = $status;
      $row['#attributes']['class'][] = 'incompatible';
    }

    // If this module requires other modules, add them to the array.     /** @var \Drupal\Core\Extension\Dependency $dependency_object */
    foreach ($module->requires as $dependency => $dependency_object) {
      // @todo Add logic for not displaying hidden modules in       // https://drupal.org/node/3117829.       if ($incompatible = $this->checkDependencyMessage($modules$dependency$dependency_object)) {
        $row['#requires'][$dependency] = $incompatible;
        $row['enable']['#disabled'] = TRUE;
        continue;
      }

      $name = $modules[$dependency]->info['name'];
      $row['#requires'][$dependency] = $modules[$dependency]->status ? $this->t('@module', ['@module' => $name]) : $this->t('@module (<span class="admin-disabled">disabled</span>)', ['@module' => $name]);
    }

    // If this module is required by other modules, list those, and then make it     // impossible to disable this one.
Home | Imprint | This part of the site doesn't use cookies.