File tree 1 file changed +9
-0
lines changed
src/com/magento/idea/magento2plugin/util/magento
1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 17
17
import org .jetbrains .annotations .Nullable ;
18
18
19
19
public final class GetModuleNameByDirectoryUtil {
20
+ public static final int THEME_SPLIT_COUNT = 1 ;
21
+ public static final String THEME_DIRECTORY_REGEX = "app\\ /design\\ /(adminhtml|frontend)\\ /" ;
20
22
21
23
private GetModuleNameByDirectoryUtil () {}
22
24
@@ -31,6 +33,13 @@ public static String execute(
31
33
final PsiDirectory psiDirectory ,
32
34
final Project project
33
35
) {
36
+ // Check if directory is theme directory and return module name from directory path if yes
37
+ final String [] splits = psiDirectory .getVirtualFile ().getPath ()
38
+ .split (THEME_DIRECTORY_REGEX );
39
+ if (splits .length > THEME_SPLIT_COUNT ) {
40
+ return splits [1 ].split ("\\ /" )[2 ];
41
+ }
42
+
34
43
final PhpFile registrationPhp = getRegistrationPhpRecursively (
35
44
psiDirectory ,
36
45
project
You can’t perform that action at this time.
0 commit comments