protected function listDirectories($type) { $directories =
[];
// Find the extensions of this type, even if they are not installed, but
// excluding test ones.
$lister = \Drupal::
service('extension.list.' .
$type);
foreach ($lister->
getAllAvailableInfo() as $name =>
$info) { // Skip obsolete and deprecated modules.
if ($info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER
] === ExtensionLifecycle::OBSOLETE ||
$info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER
] === ExtensionLifecycle::DEPRECATED
) { continue;
} $path =
$lister->
getPath($name);
// You can tell test modules because they are in package 'Testing', but
// test themes are only known by being found in test directories. So...
// exclude things in test directories.
if (!
str_contains($path, '/tests'
) && !
str_contains($path, '/testing'
)) { $directories[$name] =
$path . '/help_topics';
} }