-
-
Notifications
You must be signed in to change notification settings - Fork 168
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
CiviCRM Menu -- Add PathProcessor to allow parameters to routes to include slashes #420
Conversation
In this case, there wasn't any particular reason for using slashes instead of the traditional |
Here is an alternate solution: civicrm/civicrm-core#9650 |
From my perspective its six one way and half a dozen the other, just want to make a Drupal 8 integration possible work. The only reason to use this PR and include a PathProcessor service, is if there are other paths which will need this handling. If there are other situations where it is not so convenient to change to using ?arg style parameters, something like this will need to be anyway.... |
One other that comes to mind is |
I think it will be possible to automate CivicrmPathProcessor::processInbound() For every path we can can check it to see if its a registered Civi route, but getting the menu items array with \CRM_Core_Menu::items() If it is a civi path, then we look to see if there are additional path components, and if so, process them... The controller mods will work already with this.... So maybe we can allow these url component params with any civi path, in one swoop... This is what I had in mind with https://issues.civicrm.org/jira/browse/CRM-19843 |
@jackrabbithanna good plan! Go for it. 👍 |
all right, just made another commit, its working for the menu, and that should do it! |
$items = \CRM_Core_Menu::items(); | ||
foreach (array_keys($items) as $item) { | ||
// if he current path is a civicrm path | ||
if(('/' . $item . '/') == $path) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I'm reading it wrong but substituting values for variables this statement looks like if ('/civicrm/ajax/menujs/1/en_US/1/foo' == '/civicrm/ajax/menujs/')
which would always evaluate to false
.
ok, got an update commit.... Turns out you have to clear drupal caches every change you make to this file This works for pages and the menu... But submitting forms is doing somthing strange... So if you go to the basic contact search: Not sure if this is a problem in the Drupal code, or a different problem with drupal code, or something else entirely... civicrm/contact/search//civicrm/contact/search?_qf_Basic_display=true&qfKey=9ecd43b2ffe43cd2c4eff2d83ee153aa_8904 |
ok think I got it now, menu works, pages work, forms work.... |
Cool. And did you try it with e.g. |
yes that path works, and since I got that last commit I've been using the site, and all the ajax everywhere seems to be working great. In fact in Drupal 8 it seems quite a bit faster to me than Drupal 7....Its nice |
I'm using the yesterday's 4.7 master tarball... The API explorer gives a javascript error on page load, and in the firebug console i see: What do you think causes that? |
@jackrabbithanna this is a bug in D8 only? |
There are javascript related errors on several pages. Both the contribution page and event edit pages complain about missing Backbone... |
and its not that the backbone script isn't loading, it is... Civicrm adds its js into the head (backbone 1.0.) , and drupal is adding a different version before the end of the closing body tag (1.2.3) Will probably make a separate issue in JIRA for javascript stuff, and we may have to do some juggling to make sure civicrm can make use of the version it needs.... |
So Drupal 8 doesn't allow route parameters with slashes without some trickery.
You have to add a PathProcessor, and convert slashes to another character, in this case ':'
When we identify other paths that have parameters with slashes, we should add checks to the path processor and do a conversion....