summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Febbraro2011-06-20 17:50:26 (GMT)
committer Frank Febbraro2011-06-20 17:50:26 (GMT)
commita8a1b5aa44f1642a4d240baab2155e93557cb381 (patch)
tree9a0ec8bb7608c1dbb0471c1b3dbbf4af8ea8f1f1
parenta1771c0505dc5a4658502328fdcf57e7532435e2 (diff)
Issue #1188052 by mrfelton: Better context block clearing on admin for submissions
-rw-r--r--context.core.inc17
1 files changed, 12 insertions, 5 deletions
diff --git a/context.core.inc b/context.core.inc
index d010621..5a85e8a 100644
--- a/context.core.inc
+++ b/context.core.inc
@@ -125,11 +125,18 @@ function context_form_alter(&$form, $form_state, $form_id) {
if (!empty($form['#node_edit_form']) && arg(0) != 'admin') {
context_node_condition($form['#node'], 'form');
}
- // Clear out block info cache when an admin area form is submitted.
- if (arg(0) === 'admin' && !empty($form_state['input']) && isset($form_state['method']) && $form_state['method'] === 'post') {
- if ($plugin = context_get_plugin('reaction', 'block')) {
- $plugin->rebuild_needed(TRUE);
- }
+ // If the form is an admin for, flag it so that we can force a rebuild if needed.
+ if (path_is_admin($_GET['q'])) {
+ $form['#submit'][] = 'context_admin_form_submit';
+ }
+}
+
+/**
+ * Clear out block info cache when an admin area form is submitted.
+ */
+function context_admin_form_submit(&$form, $form_state) {
+ if ($plugin = context_get_plugin('reaction', 'block')) {
+ $plugin->rebuild_needed(TRUE);
}
}