Skip to content

add app/design path #2527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: 5.4.0-develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0).

## 2025.1.1

### Fixed

- The themes select is empty [#2527](https://github.com/magento/magento2-phpstorm-plugin/pull/2527)

## 2025.1.0

### Added
Expand Down
28 changes: 0 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,8 @@
<strong>PhpStorm IDE Plugin</strong> for a better Magento 2 development workflow.
</caption>
<thead>
<tr style="background-color: #f4f4f4;">
<td colspan="3" style="padding: 10px; font-size: 1.2em;">
<strong>Version 2025.0.0 - Contributors</strong>
</td>
</tr>
</thead>
<tbody>
<tr>
<td align="center" style="padding: 15px;">
<a href="https://github.com/YevhenZvieriev" style="text-decoration: none;">
<img src="https://avatars.githubusercontent.com/u/43544955?v=4" width="120px" height="120px" style="border-radius: 50%;" alt="Yevhen Zvieriev"/>
<br/>
<sub style="font-size: 1em;"><b>Yevhen Zvieriev</b></sub>
</a>
</td>
<td align="center" style="padding: 15px;">
<a href="https://github.com/SilinMykola" style="text-decoration: none;">
<img src="https://avatars.githubusercontent.com/u/15772032?v=4" width="120px" height="120px" style="border-radius: 50%;" alt="Mykola Silin"/>
<br/>
<sub style="font-size: 1em;"><b>Mykola Silin</b></sub>
</a>
</td>
<td align="center" style="padding: 15px;">
<a href="https://github.com/VitaliyBoyko" style="text-decoration: none;">
<img src="https://avatars.githubusercontent.com/u/20116393?v=4" width="120px" height="120px" style="border-radius: 50%;" alt="Vitalii Boiko"/>
<br/>
<sub style="font-size: 1em;"><b>Vitalii Boiko</b></sub>
</a>
</td>
</tr>
</tbody>
<tfoot>
<tr style="background-color: #f9f9f9;">
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pluginGroup = com.magento.idea.magento2plugin
pluginName = Magento PhpStorm
pluginRepositoryUrl = https://github.com/magento/magento2-phpstorm-plugin
pluginVersion = 2025.1.0
pluginVersion = 2025.1.1
pluginSinceBuild = 243.3
pluginUntilBuild = 258.*
platformType = PS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
public class Package { //NOPMD
public static final String V_FILE_SEPARATOR = "/";
public static String packagesRoot = "app/code";
public static String packagesDesignRoot = "app/design";
public static String libWebRoot = "lib/web";
public static String frameworkRootComposer = "vendor/magento/framework";
public static String frameworkRootGit = "lib/internal/Magento/Framework";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
import com.magento.idea.magento2plugin.project.Settings;
import java.util.ArrayList;
import java.util.List;

public final class IsFileInEditableModuleUtil {
Expand All @@ -29,37 +30,34 @@ public static boolean execute(final PsiFile file) {
}

/**
* Validates if a given virtual file is located within editable paths defined by Magento project structure.
* Validates if a given virtual file is located within editable paths.
*
* @param project the current project containing the virtual file
* @param virtualFile the file to check against editable module directories
* @return true if the file is in an editable module directory, false otherwise
*/
public static boolean execute(final Project project, final VirtualFile virtualFile) {
final Settings settings = Settings.getInstance(project);
List<String> magentoToFolders = settings.getMagentoFolders();
final String magentoPathUrl = MagentoPathUrlUtil.execute(project);
if (magentoPathUrl != null) {
if (magentoToFolders == null) {
magentoToFolders = List.of(
magentoPathUrl
);
} else {
magentoToFolders.add(
magentoPathUrl
);
}
}
List<String> editablePaths = settings.getMagentoFolders();
final String magentoRootPath = MagentoPathUrlUtil.execute(project);
final String magentoDesignPath = MagentoPathUrlUtil.getDesignPath(project);

if (magentoRootPath == null) {
return false;
}

if (editablePaths == null) {
editablePaths = new ArrayList<>();
}

if (magentoToFolders == null) {
return false;
editablePaths.add(magentoRootPath);
if (magentoDesignPath != null) {
editablePaths.add(magentoDesignPath);
}

final String filePath = virtualFile.getUrl();
for (final String editablePath : magentoToFolders) {
if (normalizeUrl(filePath).startsWith(normalizeUrl(editablePath))) {
final String currentFilePath = virtualFile.getUrl();
for (final String editablePath : editablePaths) {
if (normalizeUrl(currentFilePath).startsWith(normalizeUrl(editablePath))) {
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,24 @@ public static String execute(Project project) {

return null;
}

/**
* Constructs a file URL for the Magento packages root, based on the project settings.
*
* @param project the project instance
* @return the constructed file URL
*/
public static String getDesignPath(Project project) {
String magentoPath = Settings.getMagentoPath(project);
if (magentoPath != null) {
return VirtualFileManager.constructUrl(
"file",
magentoPath
+ File.separator
+ Package.packagesDesignRoot
);
}

return null;
}
}
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<idea-plugin require-restart="true">
<id>com.magento.idea.magento2plugin</id>
<name>Magento PhpStorm</name>
<version>2025.1.0</version>
<version>2025.1.1</version>
<vendor url="https://github.com/magento/magento2-phpstorm-plugin">Magento Inc.</vendor>

<description><![CDATA[
Expand Down
Loading