summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--context.core.inc14
1 files changed, 13 insertions, 1 deletions
diff --git a/context.core.inc b/context.core.inc
index 39ad931..b33a09e 100644
--- a/context.core.inc
+++ b/context.core.inc
@@ -362,8 +362,10 @@ function context_node_condition(&$node, $op) {
* Implementation of hook_form_alter().
*/
function context_form_alter(&$form, $form_state, $form_id) {
- if ($form['#id'] === 'node-form' && arg(0) != 'admin') { // Prevent this from firing on admin pages... damn form driven apis...
+ // Prevent this from firing on admin pages... damn form driven apis...
+ if ($form['#id'] === 'node-form' && arg(0) != 'admin') {
context_node_condition($form['#node'], 'form');
+ $form['#validate'][] = 'context_form_alter_node_validate';
}
if ($form_id == 'system_modules') {
context_invalidate_cache();
@@ -405,6 +407,16 @@ function content_taxonomy_form_vocabulary_submit($form, &$form_state) {
}
/**
+ * Node form validation callback.
+ *
+ * Set context also on validate, otherwise forms that don't validate drop out
+ * of context.
+ */
+function context_form_alter_node_validate($form, &$form_state) {
+ context_node_condition($form['#node'], 'form');
+}
+
+/**
* Implementation of hook_form_alter() for comment_form.
*/
function context_form_comment_form_alter(&$form, $form_state) {