Below is my requirement

I am facing an issue i want my exposed filter options to be dependent on the URL argument( i am using contextual filters), View is ajax Enabled, so i can not get the url parameters directly as in ajax request , it fetched argument from the ajax url,

I tried using Form Alter to get URl argument from view but faced this issue https://www.drupal.org/project/views/issues/3031259

$current_path = \Drupal::service('path.current')->getPath();
$current_url = \Drupal\Core\Url::fromRoute('<current>');
$path = $current_url->toString();
$alias = \Drupal::service('path.alias_manager')->getAliasByPath($path);
$args = explode('/', $alias);

Above Code does not work with ajax enabled view as it fetches argument from url at ajax path at ajax call where there is no arguments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.