You are here

public static function Configuration::scanDataStore in Configuration Management 7.2

Returns the list of components available in the DataStore.

File

lib/Drupal/configuration/Config/Configuration.php, line 172
Definition of Drupal\configuration\Config\Configuration.

Class

Configuration

Namespace

Drupal\configuration\Config

Code

public static function scanDataStore($component, $source = FALSE) {
  $list_of_components = array();
  if ($source) {
    $path = $source;
  }
  else {
    $path = drupal_realpath('config://');
  }
  $storage_system = static::getStorageSystem($component);
  $ext = $storage_system::$file_extension;
  $look_for = '/\\A' . $component . '\\..*' . $ext . '$/';
  $files = file_scan_directory($path, $look_for);
  foreach ($files as $file) {
    if (!in_array($file->name, $list_of_components)) {
      $storage = static::getStorageInstance($component);
      $storage
        ->setFileName($file->name)
        ->load();
      if ($storage
        ->withData()) {
        $list_of_components[$file->name] = $file->name;
      }
    }
  }
  return $list_of_components;
}