validateConfigImport example

foreach ($uninstalls as $module) {
      foreach (array_keys($module_data[$module]->required_by) as $dependent_module) {
        if ($module_data[$dependent_module]->status && !in_array($dependent_module$uninstalls, TRUE) && $dependent_module !== $install_profile) {
          $module_name = $module_data[$module]->info['name'];
          $dependent_module_name = $module_data[$dependent_module]->info['name'];
          $config_importer->logError($this->t('Unable to uninstall the %module module since the %dependent_module module is installed.', ['%module' => $module_name, '%dependent_module' => $dependent_module_name]));
        }
      }
      // Ensure that modules can be uninstalled.       foreach ($this->uninstallValidators as $validator) {
        $reasons = $validator instanceof ConfigImportModuleUninstallValidatorInterface ?
          $validator->validateConfigImport($module$config_importer->getStorageComparer()->getSourceStorage()) :
          $validator->validate($module);
        foreach ($reasons as $reason) {
          $config_importer->logError($this->t('Unable to uninstall the %module module because: @reason.',
            ['%module' => $module_data[$module]->info['name'], '@reason' => $reason]));
        }
      }
    }

    // Ensure that the install profile is not being uninstalled.     if (in_array($install_profile$uninstalls, TRUE)) {
      $profile_name = $module_data[$install_profile]->info['name'];
      

        public function validate($module)
        {
            return $this->lazyLoadItself()->validate($module);
        }

        /** * {@inheritdoc} */
        public function validateConfigImport(string $module, \Drupal\Core\Config\StorageInterface $source_storage): array
        {
            return $this->lazyLoadItself()->validateConfigImport($module$source_storage);
        }

        /** * {@inheritdoc} */
        public function setStringTranslation(\Drupal\Core\StringTranslation\TranslationInterface $translation)
        {
            return $this->lazyLoadItself()->setStringTranslation($translation);
        }

    }

}
Home | Imprint | This part of the site doesn't use cookies.