You are here

protected function HelpTopicDiscovery::findFiles in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/help_topics/src/HelpTopicDiscovery.php \Drupal\help_topics\HelpTopicDiscovery::findFiles()
  2. 9 core/modules/help_topics/src/HelpTopicDiscovery.php \Drupal\help_topics\HelpTopicDiscovery::findFiles()

Returns an array of providers keyed by file path.

Return value

array An array of providers keyed by file path.

1 call to HelpTopicDiscovery::findFiles()
HelpTopicDiscovery::findAll in core/modules/help_topics/src/HelpTopicDiscovery.php
Returns an array of discoverable items.

File

core/modules/help_topics/src/HelpTopicDiscovery.php, line 169

Class

HelpTopicDiscovery
Discovers help topic plugins from Twig files in help_topics directories.

Namespace

Drupal\help_topics

Code

protected function findFiles() {
  $file_list = [];
  foreach ($this->directories as $provider => $directories) {
    $directories = (array) $directories;
    foreach ($directories as $directory) {
      if (is_dir($directory)) {

        /** @var \SplFileInfo $fileInfo */
        $iterator = new RegexDirectoryIterator($directory, '/\\.html\\.twig$/i');
        foreach ($iterator as $fileInfo) {
          $file_list[$fileInfo
            ->getPathname()] = $provider;
        }
      }
    }
  }
  return $file_list;
}