File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
src/com/magento/idea/magento2plugin/util/magento Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 1818
1919public final class GetModuleNameByDirectoryUtil {
2020
21+ public static final int THEME_SPLIT_COUNT = 1 ;
22+ public static final String THEME_DIRECTORY_REGEX = "app\\ /design\\ /(adminhtml|frontend)\\ /" ;
23+
2124 private GetModuleNameByDirectoryUtil () {}
2225
2326 /**
@@ -31,6 +34,13 @@ public static String execute(
3134 final PsiDirectory psiDirectory ,
3235 final Project project
3336 ) {
37+ // Check if directory is theme directory and return module name from directory path if yes
38+ final String [] splits = psiDirectory .getVirtualFile ().getPath ()
39+ .split (THEME_DIRECTORY_REGEX );
40+ if (splits .length > THEME_SPLIT_COUNT ) {
41+ return splits [1 ].split ("\\ /" )[2 ];
42+ }
43+
3444 final PhpFile registrationPhp = getRegistrationPhpRecursively (
3545 psiDirectory ,
3646 project
You can’t perform that action at this time.
0 commit comments