function IconFinder::getFilesFromSources

Create files from source paths.

Parameters

string[] $sources: The list of paths or urls.

string $relative_path: The current definition relative path.

Return value

array<string, array<string, string|null>> List of files with metadata.

Overrides IconFinderInterface::getFilesFromSources

File

core/lib/Drupal/Core/Theme/Icon/IconFinder.php, line 128

Class

IconFinder
Icon finder to discover files under specific paths or URLs.

Namespace

Drupal\Core\Theme\Icon

Code

public function getFilesFromSources(array $sources, string $relative_path) : array {
  $result = [];
  foreach ($sources as $source) {
    // Detect if source is path or remote, parse_url will have no scheme for
    // a path.
    $url = parse_url($source);
    if (isset($url['scheme']) && isset($url['path'])) {
      $result = array_merge($result, $this->getFileFromUrl($url['scheme'], $url['path'], $source));
      continue;
    }
    $result = array_merge($result, $this->getFilesFromPath($source, $relative_path));
  }
  return $result;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.