Problem/Motivation

  1. 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();
    }
    
  2. 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

Blocking

User interface changes

No.

API changes

Yes.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sun’s picture

effulgentsia’s picture

effulgentsia’s picture

FileSize
852 bytes

Let's see what fails.

effulgentsia’s picture

Status: Active » Needs review

Ahem.

Status: Needs review » Needs work

The last submitted patch, 3: current_path.patch, failed testing.

effulgentsia’s picture

Status: Needs work » Needs review
FileSize
2.13 KB

Well, that was less than I expected :)

ParisLiakos’s picture

nice!
I guess we should now mark it as deprecated and also completely remove _current_path() ?

dawehner’s picture

Status: Needs review » Needs work

Yeah, paris is right.

webchick’s picture

Hm. 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.

tim.plunkett’s picture

We're keeping current_path(), #7 was about the helper _current_path() (with the underscore)

webchick’s picture

Oops. My mistake.

effulgentsia’s picture

Title: Figure out what to do with current_path() » Remove no longer needed _current_path() fallback for early bootstrap
Status: Needs work » Needs review
FileSize
11.64 KB

Let's see what bot thinks of this.

ParisLiakos’s picture

+++ b/core/includes/bootstrap.inc
@@ -1956,69 +1953,6 @@ function request_path() {
-function arg($index = NULL, $path = NULL) {

+++ b/core/includes/path.inc
@@ -82,18 +82,56 @@ function drupal_match_path($path, $patterns) {
+function arg($index = NULL, $path = NULL) {

any 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()

ParisLiakos’s picture

this fixes #13

effulgentsia’s picture

Thanks. 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.

ParisLiakos’s picture

Status: Needs review » Reviewed & tested by the community

the Views pager changes look valid to me and since moving around arg was not intentional, according to #15, i feel comfortable with RTBCing this

mondrake’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
2.35 KB
9.42 KB
+++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php
@@ -617,13 +616,13 @@ public function renderPreview($display_id, $args = array()) {
+      $override_path = $this->override_path;
       if ($args) {
-        $q .= '/' . implode('/', $args);
-        _current_path($q);
+        $override_path .= '/' . implode('/', $args);
       }

This 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...

ParisLiakos’s picture

this sounds like a different issue to me and seems an issue already exists. lets deal with this there?

mondrake’s picture

Status: Needs review » Reviewed & tested by the community

Fine 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.

ParisLiakos’s picture

in HEAD, pager navigation is working actually, but contextual filters are lost on any click on pager links.

this doesnt sound like it works?

effulgentsia’s picture

Status: Reviewed & tested by the community » Postponed
+++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php
@@ -617,13 +616,13 @@ public function renderPreview($display_id, $args = array()) {
-      // Also override the current path so we get the pager.
-      $original_path = current_path();
-      $q = _current_path($this->override_path);
+      // Override the system path so we get the pager.
+      $original_path = $request->attributes->get('_system_path');
+      $override_path = $this->override_path;
       if ($args) {
-        $q .= '/' . implode('/', $args);
-        _current_path($q);
+        $override_path .= '/' . implode('/', $args);
       }
+      $request->attributes->set('_system_path', $override_path);

Since 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.

YesCT’s picture

YesCT’s picture

Issue summary: View changes
YesCT’s picture

noting 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

+ * @todo This is a temporary function pending refactoring Drupal to use
+ *   Symfony's Request object exclusively.
+ */
+function _current_path($path = NULL) {
dawehner’s picture

Status: Postponed » Fixed

That function does not longer exists, yeah!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.