I have built a view with exposed filters. There is a 'popular content' block on this page which I am controlling using the Context module (https://www.drupal.org/project/context)
I would like it so that the popular content displays, but only if no filters are being applied to the view. If a filter is applied then the block should not show.
I can see that the Context module has a query string condition option which I've tried to apply but without success. I've tried adding things like ~?title=*
or ~*?title=**
here but I can't seem to get the behaviour I'm after.
Any help would be appreciated.
UPDATE
I've used the answer from @Pierr.Vriens to create a rule component. However, the block now isn't showing on the /MyViewPath page (which is /courses
on my site). I've put the export of the rule I created below. I'm surprised that it's not showing on the page now at all. The block is being set in the correct region, the 'rules' component has been added to the block settings itself and I've disabled the context module from messing with it too.
Here is an export of the rule I created:
{ "rules_block_visibility_popular_courses" : {
"LABEL" : "Hide block for filtered course view",
"PLUGIN" : "rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"USES VARIABLES" : {
"module" : { "label" : "Module", "type" : "text" },
"delta" : { "label" : "Delta", "type" : "text" },
"result" : { "label" : "Result", "type" : "boolean", "parameter" : false }
},
"IF" : [
{ "text_matches" : { "text" : [ "site:current-page:url" ], "match" : "courses " } }
],
"DO" : [ { "data_set" : { "data" : [ "result" ], "value" : "1" } } ],
"PROVIDES VARIABLES" : [ "result" ]
}
}
UPDATE 2
So it was the space at the end of "courses "
that was causing the problem. The exported rule below did the trick:
{ "rules_block_visibility_popular_courses" : {
"LABEL" : "Hide block for filtered course view",
"PLUGIN" : "rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"USES VARIABLES" : {
"module" : { "label" : "Module", "type" : "text" },
"delta" : { "label" : "Delta", "type" : "text" },
"result" : { "label" : "Result", "type" : "boolean", "parameter" : false }
},
"IF" : [
{ "text_matches" : {
"text" : [ "site:current-page:url" ],
"match" : "courses",
"operation" : "ends"
}
}
],
"DO" : [ { "data_set" : { "data" : [ "result" ], "value" : "1" } } ],
"PROVIDES VARIABLES" : [ "result" ]
}
}
/MyViewPath
like you said. With a filter applied it would look like/MyViewPath?title=&field_content_category_tid%5B%5D=32
orMyViewPath?title=&field_content_category_tid%5B%5D=32&field_more_content_tid%5B%5D=36
etc.