File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
system/Commands/Utilities/Routes Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 15
15
use CodeIgniter \Filters \Filters ;
16
16
use CodeIgniter \HTTP \Exceptions \RedirectException ;
17
17
use CodeIgniter \Router \Router ;
18
+ use Config \App ;
18
19
use Config \Feature ;
19
20
use Config \Services ;
20
21
@@ -50,6 +51,12 @@ public function find(string $uri): array
50
51
{
51
52
$ this ->filters ->reset ();
52
53
54
+ $ isLocaleExist = strpos ($ uri , '{locale} ' ) !== false ;
55
+
56
+ if ($ isLocaleExist ) {
57
+ $ uri = str_replace ('{locale} ' , config (App::class)->defaultLocale , $ uri );
58
+ }
59
+
53
60
// Add route filters
54
61
try {
55
62
$ routeFilters = $ this ->getRouteFilters ($ uri );
@@ -64,7 +71,14 @@ public function find(string $uri): array
64
71
65
72
$ this ->filters ->initialize ($ uri );
66
73
67
- return $ this ->filters ->getFilters ();
74
+ $ filters = $ this ->filters ->getFilters ();
75
+
76
+ if ($ isLocaleExist ) {
77
+ $ filters ['before ' ] = array_map (static fn ($ filter ) => '! ' . $ filter , $ filters ['before ' ]);
78
+ $ filters ['after ' ] = array_map (static fn ($ filter ) => '! ' . $ filter , $ filters ['after ' ]);
79
+ }
80
+
81
+ return $ filters ;
68
82
} catch (RedirectException $ e ) {
69
83
return [
70
84
'before ' => [],
You can’t perform that action at this time.
0 commit comments