function HelpTopicDiscovery::findFiles

Same name in other branches
  1. 8.9.x core/modules/help_topics/src/HelpTopicDiscovery.php \Drupal\help_topics\HelpTopicDiscovery::findFiles()
  2. 10 core/modules/help/src/HelpTopicDiscovery.php \Drupal\help\HelpTopicDiscovery::findFiles()
  3. 11.x core/modules/help/src/HelpTopicDiscovery.php \Drupal\help\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;
}

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