iank Posted November 24, 2023 Share Posted November 24, 2023 Hi @bernhard, I've just encountered another issue, possibly because I'm working locally with Windows. The vscode block development shortcuts for Superusers aren't linking to the block view and block php files. Specifically these: They seem to both default to pointing at the \site\modules\RockFrontend\RockFrontend.module.php rather than the individual block/view files. I'm not sure why; maybe it's a difference in the information that debug_backtrace() returns on a Windows system? I don't know if this dump of the backtrace from getTplPath() is helpful: The icons seem to be using the first 'file' entry, although the link to the view file is there... Thanks in advance, Ian. 1 Link to comment Share on other sites More sharing options...
bernhard Posted November 24, 2023 Share Posted November 24, 2023 Thx for the report. Does it work if you make this change in RockFrontend.module.php? Link to comment Share on other sites More sharing options...
iank Posted November 24, 2023 Author Share Posted November 24, 2023 Almost! Both the icons now point to the [BlockName].view.php file. I presume one should point to the [BlockName].php and one to the [BlockName].view.php file ?? I'm just using straight PHP for my blocks, not Latte. Thx, Ian. Link to comment Share on other sites More sharing options...
bernhard Posted November 24, 2023 Share Posted November 24, 2023 Can you please add this on top of ___getIcons in RockFrontend.module.php: bd($page); bd($opt); And show me the output of that dump. I'm especially interested in this: Link to comment Share on other sites More sharing options...
iank Posted November 24, 2023 Author Share Posted November 24, 2023 Hi @bernhard, Sorry for the delay. Here's what I'm getting: Thx, Ian. Link to comment Share on other sites More sharing options...
bernhard Posted November 25, 2023 Share Posted November 25, 2023 Hey @iank thx. Unfortunately that was a wrong guess from my side and it's not really helpful. I'll be mostly offline for some days and I'll have to look into it later. If you find time to debug it yourself that would be great, because it's kinda hard to do that without a windows system from my side ? But I'll try my best when I'm back. Link to comment Share on other sites More sharing options...
iank Posted November 27, 2023 Author Share Posted November 27, 2023 Hey @bernhard, I think I've found the problem. It's relating to the fact that the view file extension can be either .latte or .view.php (I'm using the .view.php version). The logic for finding the php file edit link is stripping the view file extension and then adding back ".php". This works if it's a .latte view file, but not for .view.php files. In this case, it simply strips off the last part (.php) and adds it back, so we still have the .view.php in the full path. I added this line to ___getIcons() which fixes the problem, though there might be a more elegant solution: $ext = pathinfo($opt->path, PATHINFO_EXTENSION); // php file edit link; view file can be .latte or .view.php $php = substr($opt->path, 0, strlen($ext) * -1 - 1) . ".php"; $php = str_ireplace("view.php", "php", $php); // <============== if it's a .view.php file if (is_file($php)) { .... Regards, Ian. 1 Link to comment Share on other sites More sharing options...
bernhard Posted December 3, 2023 Share Posted December 3, 2023 @iank thx I've just pushed an update to RockFrontend DEV which will soon be merged into main. Can you please check if it works for you and mark this thread as [solved]? Thx ? And thx for your help in finding the issue! Link to comment Share on other sites More sharing options...
iank Posted December 4, 2023 Author Share Posted December 4, 2023 @bernhard, That works, yes, but only if you update the $file = Paths::normalizeSeparators($step['file']); in the getTplPath() method as well, as you suggested earlier.. 1 Link to comment Share on other sites More sharing options...
bernhard Posted December 4, 2023 Share Posted December 4, 2023 Thx. Fixed ? 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now