1 config.inc config_uninstall_config($project, $config_name = NULL)

Uninstall all the configuration provided by a project.

@since 1.26.0 First parameter changed from $module to $project.

Parameters

string $project: The name of the project we are uninstalling.

string|NULL $config_name: (optional) If wanting to remove just a single configuration file from the project, specify the configuration file name without the extension.

File

core/includes/config.inc, line 326
This is the API for configuration storage.

Code

function config_uninstall_config($project, $config_name = NULL) {
  // If this is a theme key, load the matching template.php file.
  if (!backdrop_load('module', $project) && $theme_path = backdrop_get_path('theme', $project)) {
    if (file_exists($theme_path . '/template.php')) {
      include_once $theme_path . '/template.php';
    }
  }

  if ($configs = module_invoke($project, 'config_info')) {
    foreach ($configs as $config_name => $config_info) {
      if (isset($config_info['name_key'])) {
        $sub_names = config_get_names_with_prefix($config_name . '.');
        foreach ($sub_names as $sub_name) {
          config($sub_name)->delete();
        }
      }
      else {
        config($config_name)->delete();
      }
    }
  }
}