Skip to content
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

Superficial fixes to form template - hints, array syntax #313

Merged
merged 1 commit into from
Oct 11, 2023

Conversation

eileenmcnaughton
Copy link
Contributor

This function is pretty prevalent in civix generated stuff - could be a mixin or core function - but probably just getting it to nice arrays etc is a step forwards

After running it the only php grumble is it can't see that the class is called - @totten would be cool if your phpstorm extension could pick up that xml declarations make it called - but I assume that's a big lift

image

@totten
Copy link
Owner

totten commented Oct 11, 2023

Patch looks good. Test-run is happy. (I'm pretty any hard-to-see typos would cause a failure.) Let's merge.

After running it the only php grumble is it can't see that the class is called - @totten would be cool if your phpstorm extension could pick up that xml declarations make it called - but I assume that's a big lift

  • In the phpstorm.meta.php spec, I don't see an obvious way to express a "Find usage"-type-reference between an XML file and PHP file.
  • It looks like Jetbrains plugin API could be used to define references. But we'd have to write/maintain a real "plugin". (This is traditionally Java-based, but there might be an option for JS-based micro-plugin.) That is a deeper dive.
  • A quick hack might be to... generate a plain PHP file that mirrors the routing table? The "Find Usages" wouldn't go directly to the relevant XML, but I guess it would point in the right direction.
<?php
// AUTO-GENERATED: This mirrors the routing table so that the IDE gives some more hints about usage.

define('CORE', '/home/totten/bknix/build/dmaster/web/sites/all/modules/civicrm');
$routes = [
  [
    'path' => 'civicrm/contact/view/activity',
    'page_callback' => ['CRM_Activity_Page_Tab', 'run'],
    '_source' => include(CORE . '/CRM/Core/xml/Menu/Contact.xml'),
    // We don't really care to include(), but PhpStorm supports drill-down on static include() calls, so this facilitates code-navigation.
  ]
];

@totten totten merged commit 351bdde into totten:master Oct 11, 2023
@eileenmcnaughton eileenmcnaughton deleted the hints branch October 11, 2023 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants