4

I am using Drupal 7.14 and the Context module (7.x-3.0-beta4).

I set block visibility settings and the Context module doesn't seems to be checking them before rendering. Only context conditions are validated before rendering a block.

I would like to use PHP code as visibility conditions to render a block, but Context module is not respecting block visibility settings.

Is it a bug? Or context module is designed to respect only Context Visibility settings but not block visibility settings that are enabled in a particular context.

Any idea ?

3

Context module ignores Block visibility settings

The Context module does not check (take into account) the "Block visibility settings". If you want that to be the case, then you need to also use the Context Respect module. Some details about this module, from its project page:

Extends the Context module by making it respect default block settings.

This makes it so you can retain your block visibility when assigning them into various Contexts. You can also 'Override' from the block level to ignore Context Respect.

Alternative to Context module

Have a look at the Rules block visibility module as a valid alternative. Refer to my answer to "How to stop a Views block from displaying to admins, such as user/1?" for more details about it.

By using this module as an alternative, you'd only have to create a Rules Component with Rules Conditions that could be identical to the "PHP code" as in your question. However, if you can, you should try to avoid such PHP code if you have other Rules Conditions available that could be used as an alternative to such PHP code.

0

Context module does not care what you write on block visiblity settings. It will only check context conditions. Here is the link which will help you have context and drupal core block system work together. http://www.echoditto.com/blog/mixing-context-and-drupals-native-block-ordering-system

0

Try the Context Respect Module:

Extends the Context module by making it respect default block settings.

This makes it so you can retain your block visibility when assigning them into various Contexts. You can also 'Override' from the block level to ignore Context Respect.

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.