You are here

function _bootstrap_file_scan_directory in Express 8

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.

See also

\Drupal\bootstrap\Theme::fileScan()

file_scan_directory()

File

themes/contrib/bootstrap/deprecated.php, line 225
This contains deprecated functions that will be removed in a future release.

Code

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);
}