1

In a view an exposed filter of type taxonomy reference exists, the referenced taxonomy vocabulary contains about 15 terms, the functionality I'm trying to get is to allow user call view with a default value for filter, so if user enter the path sitename/view-name/term-name the view would be load with entities of term term1.

I used contextual filter for limiting entities to those having specific term-name but the problem is, if user selects another term name, rather than the one specified in contextual filter, the view returns no result (term reference in node accepts only one value).

So I wanted to know if there is a solution to set the exposed filter default value based on url?

1

Well after some research I could found the answer. Actually drupal itself do provide such functionality and there is no need to code or ...

When exposing a field as filter to user, in filter settings window a filter identifier can be set (this can't be empty and is filled with field name by default), this is shown in image below :

enter image description here

in above example the identifier is set as cat, in this situation the path sitename/view-address/?cat=term-1 will load the view with my exposed filter assigned as term-1 and corespond entities.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.