1

I need hide a view when some GET param exists. It should be hidden like if you insert 'Global: Null' in contextual filter(It hides view if no results). This view placed in panel*

I tried to find the solution but failed. How to do this?

2

3 Answers 3

1

You just have to specify a validation criteria in a contextual filter, could be Global:null as you said. Then choose the action you want to take when validation fails. You can implement your validation logic in PHP, preferably inside a function in your code and you just call it from the view. Hope that helps.

1

Maybe if you override the views template and add a if statement, something like if (function == true) { //do something } (Sorry, really horrible in PHP...)

1

I am guessing you are adding it as a block to a specific path. If yes, follow the steps below:

  1. Go to the block configuration
  2. Scroll down to the Visibility Settings
  3. Click on "Pages" tab
  4. Select the option "Pages on which this PHP code returns TRUE (experts only)"
  5. Write your PHP logic to read the GET parameters and return true only if the specific parameter you are looking for is not found.
2
  • First, I don't use blocks I use content panes. Second, how do I know that view have empty result?
    – FriOne
    Oct 16, 2014 at 8:03
  • Ew ew ew ew ew ew. Don't use PHP inside views, you should be using hooks. May 30, 2017 at 11:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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