You are here

function context_ui_editor_submit in Context 6.3

Same name and namespace in other branches
  1. 7.3 context_ui/context_ui.module \context_ui_editor_submit()

Save handler for context_block_editor().

1 string reference to 'context_ui_editor_submit'
context_ui_editor in context_ui/context_ui.module
Inline context editor form.

File

context_ui/context_ui.module, line 211

Code

function context_ui_editor_submit(&$form, &$form_state) {
  foreach ($form_state['values']['contexts'] as $name => $values) {
    $original_conditions = $values['context']->conditions;
    $original_reactions = $values['context']->reactions;
    $context = context_ui_editor_process($values);
    if ($original_conditions !== $context->conditions || $original_reactions !== $context->reactions) {
      if (context_save($context)) {
        drupal_set_message(t('Saved %title.', array(
          '%title' => !empty($context->description) ? $context->description : $context->name,
        )));
      }
      else {
        drupal_set_message(t('Could not save context %title.', array(
          '%title' => $context->name,
        )), 'error');
      }
    }
  }
  return;
}