You are here

function context_form_alter in Context 6.3

Same name and namespace in other branches
  1. 8.4 context.module \context_form_alter()
  2. 6 context.core.inc \context_form_alter()
  3. 6.2 context.core.inc \context_form_alter()
  4. 7.3 context.core.inc \context_form_alter()

Implementation of hook_form_alter().

File

./context.core.inc, line 143

Code

function context_form_alter(&$form, $form_state, $form_id) {

  // 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';
  }
  else {
    if ($form_id == 'system_modules') {
      context_invalidate_cache();
    }
  }

  // Clear out block info cache when an admin area form is submitted.
  if (arg(0) === 'admin' && !empty($form_state['post']) && (!isset($form_state['method']) || $form_state['method'] !== 'get')) {
    if ($plugin = context_get_plugin('reaction', 'block')) {
      $plugin
        ->rebuild_needed(TRUE);
    }
  }
}