1 system.module system_config_update_validate(Config $staging_config, Config $active_config, $all_changes)

Implements hook_config_update_validate().

File

core/modules/system/system.module, line 3352
Configuration system that lets administrators modify the workings of the site.

Code

function system_config_update_validate(Config $staging_config, Config $active_config, $all_changes) {
  $config_name = $staging_config->getName();
  if ($config_name === 'system.extensions') {
    foreach (array('modules', 'themes') as $extension_type) {
      $staging_list = array_filter($staging_config->get($extension_type));
      $current_list = array_filter($active_config->get($extension_type));
      $removed_list = array_keys(array_diff_key($current_list, $staging_list));
      if ($removed_list) {
        if ($extension_type === 'modules') {
          $error = format_plural(count($removed_list), 
          'The module "@module_list" cannot be disabled on config import.', 
          'Modules (@module_list) cannot be disabled on config import.', 
          array(
            '@module_list' => implode(', ', $removed_list),
          )
          );
          $error .= ' ' . t('Try disabling and uninstalling from the <a href="!url">modules administration page</a>.', array('!url' => url('admin/modules')));
        }
        else {
          $error = format_plural(count($removed_list), 
          'The theme "@theme_list" cannot be disabled on config import.', 
          'Themes (@theme_list) cannot be disabled on config import.', 
          array(
            '@theme_list' => implode(', ', $removed_list),
          )
          );
          $error .= ' ' . t('Try disabling from the <a href="!url">themes administration page</a>.', array('!url' => url('admin/appearance')));
        }
        throw new ConfigValidateException($error);
      }
    }
  }
}