I've been running into a lot of performance issues (some fixed now) where context doing too much work in the 'reaction' part, particularly when viewing the admin theme. The latest one is #2088351: Dont render blocks for regions that aren't REGIONS_VISIBLE. Maybe i'm approaching this wrong... Is there an easy way to have a sitewide condition that only triggers when users are browsing the site, not when users are admnistering the site?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tekante’s picture

Would a combination of require all conditions with a sitewide condition along with a path condition of
~admin/*
~node/*/edit
work for what you are trying to accomplish? I think if implementing this as an official condition it would want to make use of something like !path_is_admin(current_path()) in the check.

tekante’s picture

Attached is a sample patch of how the sitewide context condition might be modified to provide admin and non admin conditions in addition to the current always active condition.

joelcollinsdc’s picture

Assigned: Unassigned » joelcollinsdc
Status: Active » Needs review

sweet

iKb’s picture

Just added a condition to #2 to avoid warning

'#default_value' => isset($value['sitewide']) ? $value['sitewide'] : 0,

joelcollinsdc’s picture

I changed the array index from 'sidewide' back to 1 to allow for backwards compatability with existing contexts. Basically, if this gets renamed to 'sidewide', all existing sitewide conditions will break.

Let me know what yall think. I've tested, it works great otherwise

marcelovani’s picture

Issue summary: View changes

The patch sounds like a good idea, I had previously created a module to deal with this problem https://www.drupal.org/project/context_admin_exclude