You are here

function metatag_context_config_edit_form_submit in Metatag 7

FormAPI callback for the final submission.

1 string reference to 'metatag_context_config_edit_form_submit'
metatag_context_config_edit_form in metatag_context/metatag_context.admin.inc
FormAPI callback to build the edit form.

File

metatag_context/metatag_context.admin.inc, line 185
Admin settings page for Metatag Context.

Code

function metatag_context_config_edit_form_submit($form, &$form_state) {
  $context = $form_state['metatag_context']['context'];
  $context->reactions['metatag_context_reaction']['metatags'] = $form_state['values']['metatags'];
  $paths = explode("\n", str_replace("\r", "", $form_state['values']['paths']));
  $paths = array_combine($paths, $paths);
  $context->conditions['path']['values'] = $paths;
  context_save($context);

  // Update the i18n strings.
  if (!empty($context->reactions['metatag_context_reaction']['metatags'][LANGUAGE_NONE])) {
    metatag_translations_update($context->reactions['metatag_context_reaction']['metatags'][LANGUAGE_NONE], 'metatag_context:' . $context->name);
  }
  $form_state['redirect'] = 'admin/config/search/metatags/context';
}