Views Current Path provides a Views field that prints the current path, or part
of the current path, of the current page. It has options for system or alias
paths, relative and absolute paths, just the query string or just the base url.
If using the relative alias path, then you also have options for how to handle
query strings including adding additional query strings or removing the query
strings altogether.
IMPORTANT: Within the View configuration Preview, you will only see
placeholders (e.g. [current_path]). You will need to save the View and look
at the Page or block to see the result.
Differences from Drupal 7
A "domain only" option was added as an Output style as it was trivial to add and
provides greater flexibility.
Installation
- Install this module using the official Backdrop CMS instructions at
https://docs.backdropcms.org/documentation/extend-with-modules.
Usage
- Create/edit your view and click to add a new field.
- In the "Add fields" window, choose "Global: Current Path".
- Configure the field options and apply it to your display.
Although there are many use-cases for this functionality, the most common use is
taking advantage of the "Rewrite results" section in other fields where you can
use this field token (i.e. [current_path]) in the text or adding it to the
"Output this field as a link" input box.
It is possible to add multiple instances of this field to a View so you can
compile URLs to meet your needs. If you do this, it is recommended that you set
an Administrative title under the More tab at the bottom of the Configure Field
dialog.
An example of usage can be found in Views Fix 404 Pages Filter Recipe.
Issues
Bugs and Feature Requests should be reported in the Issue Queue:
https://github.com/backdrop-contrib/views_current_path/issues.
Current Maintainers
- Martin Price - System Horizons Ltd
- Collaboration welcome!
Credits
- Ported to Backdrop CMS by - Martin Price - System Horizons Ltd.
- Port sponsored by Olaf Grabienski.
- Drupal module:
- Originally written for Drupal by Mikey O'Toole
- Drupal 7 version also maintained by hargobind
- Original concept taken from:
http://drupal.stackexchange.com/questions/49377/get-the-current-path-in-views
License
This project is GPL v2 software.
See the LICENSE.txt file in this directory for complete text.