Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
foreach ($directories as $dir) {
if (file_exists($dir)) {
$files = array_merge($files, file_scan_directory($dir, '@^[a-z0-9._-]+\.libraries\.info$@', array(
'key' => 'name',
'recurse' => TRUE,
)));
}
}
for keep libraries separately in their folders
Comments
Comment #1
tstoecklerIt seems what you mean is that recursing the scan would allow to group libraries in separate folders. The problem with this is, that this would also mean scanning the libraries itself. So as soon as a library contains a foo.libraries.info file, this would break. Now that's not very likely to happen, but anyway it feels wrong to scan external library files in the first place. Can you make a strong case for this?
Comment #2
sunThe scan for .info files should not diverge from the folder/directory scan, whereas the latter can only take first-level directories into account.
Comment #3
Punk_UnDeaDNow I have 16 folders with libraries
I use a separate folder for each library
if keep it one folder, will be garbage
Comment #4
m4tlch CreditAttribution: m4tlch commented*deleted*
Comment #5
tstoecklerJust saw that people are still posting here, so temporarily re-opening.
Changing the code that scans for info files to do so recursively is not a problem technically, but as #1 and #2 try to explain we specifically do not want to do that. So if you want to group your libraries into sub-folders, there needs to be some way to tell libraries API that you've done so and how many levels deep you've grouped them. Unless somebody has an elegant proposal for doing that, I don't see this being that important.
Also maybe someone should explain (in detail) what is so annoying about not being able to group the libraries. I fail to see how that is such a problem.
Comment #6
tstoecklerClosing this again after the lack of feedback.