function _bootstrap_file_scan_directory

8.x-3.x deprecated.php _bootstrap_file_scan_directory($dir, $mask, array $options = [])
7.x-3.x _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');


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.


Will be removed in a future release.

Source ./deprecated.php (line 226)

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