function IconFinder::findFiles
Creates a Finder instance with configured patterns and return result.
Parameters
string $path: The path to search for icons.
string $names: The file names for Finder::names().
Return value
\Symfony\Component\Finder\Finder|null The configured Finder instance.
1 call to IconFinder::findFiles()
- IconFinder::getFilesFromPath in core/
lib/ Drupal/ Core/ Theme/ Icon/ IconFinder.php - Get files from a local path.
File
-
core/
lib/ Drupal/ Core/ Theme/ Icon/ IconFinder.php, line 256
Class
- IconFinder
- Icon finder to discover files under specific paths or URLs.
Namespace
Drupal\Core\Theme\IconCode
private function findFiles(string $path, string $names) : ?Finder {
$path = str_replace(self::GROUP_PATTERN, '*', $path);
$finder = new Finder();
try {
$finder->depth(0)
->in($path)
->files()
->name($names)
->sortByExtension();
} catch (\Throwable) {
$this->logger
->warning('Invalid icon path in source: @source', [
'@source' => $path,
]);
return NULL;
}
if (!$finder->hasResults()) {
$this->logger
->warning('No icon found in source: @source', [
'@source' => $path,
]);
return NULL;
}
return $finder;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.