public InstallStorage::getComponentNames(array $list)
Get all configuration names and folders for a list of modules or themes.
\Drupal\Core\Extension\Extension[] $list: An associative array of Extension objects, keyed by extension name.
array Folders indexed by configuration name.
public function getComponentNames(array $list) { $extension = '.' . $this->getFileExtension(); $pattern = '/' . preg_quote($extension, '/') . '$/'; $folders = array(); foreach ($list as $extension_object) { // We don't have to use ExtensionDiscovery here because our list of // extensions was already obtained through an ExtensionDiscovery scan. $directory = $this->getComponentFolder($extension_object); if (is_dir($directory)) { // glob() directly calls into libc glob(), which is not aware of PHP // stream wrappers. Same for \GlobIterator (which additionally requires // an absolute realpath() on Windows). // @see https://github.com/mikey179/vfsStream/issues/2 $files = scandir($directory); foreach ($files as $file) { if ($file[0] !== '.' && preg_match($pattern, $file)) { $folders[basename($file, $extension)] = $directory; } } } } return $folders; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Config!InstallStorage.php/function/InstallStorage::getComponentNames/8.1.x