You are here

function context_ui_editor_submit in Context 7.3

Same name and namespace in other branches
  1. 6.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 250

Code

function context_ui_editor_submit(&$form, &$form_state) {
  foreach ($form_state['values']['contexts'] as $name => $values) {
    $original_reactions = var_export($values['context']->reactions, TRUE);
    $context = context_ui_editor_process($values);

    //compare string values instead of actual objects to avoid problems with aliasing
    if ($original_reactions !== var_export($context->reactions, TRUE)) {
      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;
}