function _bootstrap_file_scan_directory

8 deprecated.php _bootstrap_file_scan_directory($dir, $mask, array $options = [])
7 common.inc _bootstrap_file_scan_directory($dir, $mask, array $options = array())

Wrapper for the core file_scan_directory() function.

Finds all files that match a given mask in a given directory and then caches the results. A general site cache clear will force new scans to be initiated for already cached directories.

  // Before.
  $files = _bootstrap_file_scan_directory($theme_path . '/js', '/\.js$/');

  // After.
  use Drupal\bootstrap\Bootstrap;
  $files = Bootstrap::getTheme()->fileScan('/\.js$/', 'js');

Parameters

string $dir: The base directory or URI to scan, without trailing slash.

string $mask: The preg_match() regular expression of the files to find.

array $options: Additional options to pass to file_scan_directory().

Return value

array An associative array (keyed on the chosen key) of objects with 'uri', 'filename', and 'name' members corresponding to the matching files.

Deprecated

Will be removed in a future release.

Source ./deprecated.php (line 225)

function _bootstrap_file_scan_directory($dir, $mask, array $options = []) {
  Bootstrap::deprecated();
  $theme = Bootstrap::getTheme();
  $dir = preg_replace('/^' . preg_quote($theme->getPath()) . '\//', '', $dir);
  return $theme->fileScan($mask, $dir, $options);
}