I'm trying to get an argument from search page URL so that I can pass that argument to a link.
For example I have this URL for a search results page:
http://domain.com/site-search?search_api_fulltext=foo
And on that page I want to have a link that goes to:
http://domain.com/other-search?search_api_fulltext=foo
I've tried {{ url('<current>') }}
but that only returns the domain and path, but not the arguments. I've been trying stuff like {{ app.request.requestUri }}
but that returns nothing.
FWIW, I'm trying to include these links in a custom block that appears on the search results page.
function MYTHEME_preprocess_block(&$variables) { $current_path = \Drupal::service('path.current')->getPath(); $variables['current_path'] = $current_path; }
But its still not returning the arguments, just the page path. – fallenturtle Dec 6 '19 at 18:58function rcorpta_preprocess_block(&$variables) { $current_path = \Drupal::request()->getRequestUri(); $variables['current_path'] = $current_path; }
– fallenturtle Dec 6 '19 at 19:04