We use modalframes for popups. Modalframes draw a new page inside an iframe. This was problematic because it gave us a second olark chat box inside the modal. Using contexts in this case seemed kludgey.

To fix this I've implemented hook_suppress in olark. Patch to follow. This hook doesn't follow convention at all, so I'm going to be a little more verbose here than would usually be necessary. It was originally a part of admin_menu, used for hiding the menu in certain situations but a few other modules have started picking it up too. (http://drupal.org/node/249537)

hook_suppress is responsible for checking and setting a static variable which serves as a flag for whether or not to display certain blocks. The code is virtually the same for any module that implements it. Modules that are suppressible are responsible for calling their own suppress hook to find out if they should display or not. In this case I added it to olark_footer in the same conditional where olark_enable is checked.

Other modules (in my case, modalframe) are responsible for calling module_invoke_all('suppress') when they deem it necessary to hide suppressible content. So, defining and checking hook_suppress basically opts your module in to have its block excluded in certain conditions.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jsagotsky’s picture

Status: Active » Needs review
FileSize
6.05 KB

Here's the patch.

iler’s picture

Assigned: Unassigned » iler
iler’s picture

Assigned: iler » Unassigned
Status: Needs review » Needs work

This patch either isn't done against the latest dev version or it removes the hook_init. Could you please redo the patch so it doesn't remove the hook_init. The hook_init is there to fix the bug where the settings and olark.js where not inserted.

jsagotsky’s picture

Status: Needs work » Needs review
FileSize
1.4 KB

My sources were out of date. Sorry about that.

iler’s picture

Status: Needs review » Fixed

Tested, reviewed and pushed to dev branch.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.