Skip to content

Commit f2edc2a

Browse files
author
Olivier Laviale
committed
Using autoconfig-filters
1 parent f48e7b2 commit f2edc2a

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545

4646
"icanboogie": {
4747

48-
"config-path": "config"
49-
48+
"config-path": "config",
49+
"autoconfig-filters": [ "ICanBoogie\\Module\\Hooks::filter_autoconfig" ]
5050
}
5151
}
5252
}

lib/Hooks.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,28 @@
1919

2020
class Hooks
2121
{
22+
/*
23+
* Config
24+
*/
25+
26+
/**
27+
* Adds "modules" directories found in the app directories to `module-path`.
28+
*
29+
* @param array $autoconfig
30+
*/
31+
static public function filter_autoconfig(array &$autoconfig, $root)
32+
{
33+
$directories = \ICanBoogie\resolve_app_paths($root);
34+
35+
foreach ($directories as $directory)
36+
{
37+
if (file_exists($directory . 'modules'))
38+
{
39+
$autoconfig['module-path'][] = $directory . 'modules';
40+
}
41+
}
42+
}
43+
2244
/*
2345
* Events
2446
*/

0 commit comments

Comments
 (0)