views:

80

answers:

2

I have a site built in Drupal 6 that requires a number of blocks that are only visible to certain roles or on specific pages. Normally, I would use the block configuration settings to control page and role visibility. However I recently ran across the context module that effectively splits the site into "sections" or "groups" of related attributes.

My question is: When is it appropriate to control block visibility from context rather than the block configuration settings? Should I only use one or the other or a combination of both?

+1  A: 

There is no hard and fast rule for when to use core block placement, and when to use context. In general though, if you have a lot of blocks, with different and complex visibiity logic, context will make things more manageable. Additionally, contexts can be exported to code, which allows one to more easily track block configurations in version control. When storing contexts in code, this also allows changes to blocks to be deployed to a production site by simply updating the code, rather than needing to log in and manually move things around via the UI.

jhedstrom
+1  A: 

these are different approaches meant for different use cases, but they are not mutually exclusive.

context indeed splits the site into different contexts (and there is also the possibility of context types). and that is effectively its use case: context-based block showing/positioning.

however context won't check for user roles nor multilingual settings (i18n). block supports these cases (and you can combine both context and block to show something on a context depending on user role).

block also allows users to choose whether they want to see the box or not.

my final answer is: combine instead of choosing.

barraponto