1 config.inc config_get_default_config_names($project)

Gets the name of config files provided by a module or theme.

@since 1.31.0 Function added.

Parameters

$project: The name of the project for which config names should be returned.

Return value

string[]: An unindexed array of config names, without the .json extension.

File

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

Code

function config_get_default_config_names($project) {
  $project_path = NULL;
  foreach (array('module', 'theme') as $project_type) {
    if ($project_path = backdrop_get_path($project_type, $project)) {
      break;
    }
  }

  $config_names = array();
  $project_config_dir = $project_path . '/config';
  if (is_dir($project_config_dir)) {
    $files = glob($project_config_dir . '/*.json');
    foreach ($files as $file) {
      $parts = explode('/', $file);
      $file = array_pop($parts);
      $config_names[] = str_replace('.json', '', $file);
    }
  }

  return $config_names;
}