Skip to content

Commit 07fc246

Browse files
authored
Merge branch '3.1.0-develop' into issue-424
2 parents ad4ee7e + c67fc7a commit 07fc246

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/com/magento/idea/magento2plugin/util/magento/GetModuleNameByDirectoryUtil.java

+10
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818

1919
public 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

0 commit comments

Comments
 (0)