Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
-
Originally supposed to be resolved by #1269742: Make path lookup code into a pluggable class,
current_path()
+_current_path()
still exist:function current_path() { // @todo Remove the check for whether the request service exists and the // fallback code below, once the path alias logic has been figured out in // http://drupal.org/node/1269742. if (\Drupal::getContainer()->isScopeActive('request')) { $path = \Drupal::request()->attributes->get('_system_path'); if ($path !== NULL) { return $path; } } // If we are outside the request scope, fall back to using the path stored in // _current_path(). return _current_path(); }
-
Also the issue for the @todo from #1183208: Remove variable_get('clean_url') and switch to index.php/path pattern for dirty URL support
core/includes/bootstrap.inc#+ * @todo This is a temporary function pending refactoring Drupal to use + * Symfony's Request object exclusively. + */ +function _current_path($path = NULL) {
Proposed resolution
?
Remaining tasks
- postponed on #2066207: Contextual filters in view preview UI are not retained on preview navigation
- ?
Blocking
User interface changes
No.
API changes
Yes.
Comment | File | Size | Author |
---|---|---|---|
#17 | current_path-2237001-17.patch | 9.42 KB | mondrake |
#17 | interdiff_14-17.txt | 2.35 KB | mondrake |
#14 | current_path-2237001-14.patch | 8.04 KB | ParisLiakos |
#14 | interdiff.txt | 4.6 KB | ParisLiakos |
#12 | current_path-2237001-11.patch | 11.64 KB | effulgentsia |
Comments
Comment #1
sunComment #2
effulgentsia CreditAttribution: effulgentsia commentedComment #3
effulgentsia CreditAttribution: effulgentsia commentedLet's see what fails.
Comment #4
effulgentsia CreditAttribution: effulgentsia commentedAhem.
Comment #6
effulgentsia CreditAttribution: effulgentsia commentedWell, that was less than I expected :)
Comment #7
ParisLiakos CreditAttribution: ParisLiakos commentednice!
I guess we should now mark it as deprecated and also completely remove
_current_path()
?Comment #8
dawehnerYeah, paris is right.
Comment #9
webchickHm. Can we not just keep this function as a convenience wrapper? It's called a lot from preprocess functions and .module files according to #2239009-6: Remove public direct usage of the '_system_path' request attribute, and those things can never be dependency-injected.
Comment #10
tim.plunkettWe're keeping
current_path()
, #7 was about the helper_current_path()
(with the underscore)Comment #11
webchickOops. My mistake.
Comment #12
effulgentsia CreditAttribution: effulgentsia commentedLet's see what bot thinks of this.
Comment #13
ParisLiakos CreditAttribution: ParisLiakos commentedany reason
arg()
is moved around here? i dont really see the reason and it will unneedlessly break other patches, eg #788900: Deprecate and remove usages of arg()Comment #14
ParisLiakos CreditAttribution: ParisLiakos commentedthis fixes #13
Comment #15
effulgentsia CreditAttribution: effulgentsia commentedThanks. I'm happy with #14. Since many hunks in the patch are mine, I'm refraining from RTBC'ing, especially since the Views pager related changes are not entirely trivial.
Comment #16
ParisLiakos CreditAttribution: ParisLiakos commentedthe Views pager changes look valid to me and since moving around arg was not intentional, according to #15, i feel comfortable with RTBCing this
Comment #17
mondrakeThis is preventing pager navigation in case you have contextual filters enabled, and you enter a filter value in the 'Preview with contextual filters' textbox. I'm no expert here, but suspect that's somewhat to do with the path finally built and the routing system.
This somehow relates with #2066207: Contextual filters in view preview UI are not retained on preview navigation; in HEAD, pager navigation is working actually, but contextual filters are lost on any click on pager links. With #14 contextual filters are retained, but no pager navigation :(
The patch attached builds on #14 and attempts to solve the lack of navigation by moving the contextual filters to a query parameter instead of appending to the path. Not sure it's the right way to go though...
Comment #18
ParisLiakos CreditAttribution: ParisLiakos commentedthis sounds like a different issue to me and seems an issue already exists. lets deal with this there?
Comment #19
mondrakeFine with me. Just let's be aware that view preview pager navigation with contextual filters won't work, temporarily.
Patch to review is still #14.
Comment #20
ParisLiakos CreditAttribution: ParisLiakos commentedthis doesnt sound like it works?
Comment #21
effulgentsia CreditAttribution: effulgentsia commentedSince in HEAD, _current_path() and _system_path are not automatically sync'ed, the above hunk is not a no-op, and likely responsible for causing the functional change described in #17. Therefore, let's postpone this on getting the correct functionality into HEAD, along with a test, in #2066207: Contextual filters in view preview UI are not retained on preview navigation.
Comment #22
YesCT CreditAttribution: YesCT commented#2251061-25: arg(0) returns path prefix with Language Path Negotiation enabled is wondering if we should wait on this, or try and fix _current_path()
Comment #23
YesCT CreditAttribution: YesCT commentedComment #24
YesCT CreditAttribution: YesCT commentednoting this is the @todo from #1183208: Remove variable_get('clean_url') and switch to index.php/path pattern for dirty URL support
core/includes/bootstrap.inc
Comment #25
dawehnerThat function does not longer exists, yeah!