File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
src/com/magento/idea/magento2plugin/util/magento Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 1717import org .jetbrains .annotations .Nullable ;
1818
1919public final class GetModuleNameByDirectoryUtil {
20+ public static final int THEME_SPLIT_COUNT = 1 ;
21+ public static final String THEME_DIRECTORY_REGEX = "app\\ /design\\ /(adminhtml|frontend)\\ /" ;
2022
2123 private GetModuleNameByDirectoryUtil () {}
2224
@@ -31,6 +33,13 @@ public static String execute(
3133 final PsiDirectory psiDirectory ,
3234 final Project project
3335 ) {
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+
3443 final PhpFile registrationPhp = getRegistrationPhpRecursively (
3544 psiDirectory ,
3645 project
You can’t perform that action at this time.
0 commit comments