Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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?
Comment | File | Size | Author |
---|---|---|---|
#5 | context-sitewide_non_admin_condition-2089925-5.patch | 2.3 KB | joelcollinsdc |
#4 | context-sitewide_non_admin_condition-2089925-4.patch | 2.34 KB | iKb |
#2 | context-sitewide_non_admin_condition-2089925-2.patch | 2.31 KB | tekante |
Comments
Comment #1
tekante CreditAttribution: tekante commentedWould 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.
Comment #2
tekante CreditAttribution: tekante commentedAttached 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.
Comment #3
joelcollinsdc CreditAttribution: joelcollinsdc commentedsweet
Comment #4
iKb CreditAttribution: iKb commentedJust added a condition to #2 to avoid warning
'#default_value' => isset($value['sitewide']) ? $value['sitewide'] : 0,
Comment #5
joelcollinsdc CreditAttribution: joelcollinsdc commentedI 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
Comment #6
marcelovaniThe 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