File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 44 'block_model_class ' => Redberry \PageBuilderPlugin \Models \PageBuilderBlock::class,
55
66 'polymorphic_relationship_name ' => 'page_builder_blockable ' ,
7+
8+ 'global_blocks_discovery_paths ' => [
9+ 'app/Filament/*/Blocks/Globals ' ,
10+ 'app/Filament/Blocks/Globals ' ,
11+ ],
712];
Original file line number Diff line number Diff line change @@ -89,7 +89,24 @@ protected static function discoverGlobalBlocks(): array
8989 $ globalBlocks = [];
9090 $ appPath = app_path ();
9191
92- $ globalsDirectories = File::glob ($ appPath . '/Filament/*/Blocks/Globals ' );
92+ $ discoveryPaths = config ('page-builder-plugin.global_blocks_discovery_paths ' , [
93+ 'app/Filament/*/Blocks/Globals ' ,
94+ ]);
95+
96+ $ globalsDirectories = [];
97+
98+ foreach ($ discoveryPaths as $ pattern ) {
99+ $ fullPattern = $ appPath . '/ ' . ltrim ($ pattern , 'app/ ' );
100+
101+ if (str_contains ($ pattern , '* ' )) {
102+ $ directories = File::glob ($ fullPattern );
103+ $ globalsDirectories = array_merge ($ globalsDirectories , $ directories );
104+ } else {
105+ if (File::isDirectory ($ fullPattern )) {
106+ $ globalsDirectories [] = $ fullPattern ;
107+ }
108+ }
109+ }
93110
94111 foreach ($ globalsDirectories as $ directory ) {
95112 $ files = File::glob ($ directory . '/*.php ' );
You can’t perform that action at this time.
0 commit comments