You are here

function simplemeta_meta_form_submit_save in Simple Meta 6.2

Same name and namespace in other branches
  1. 7 simplemeta.module \simplemeta_meta_form_submit_save()
1 string reference to 'simplemeta_meta_form_submit_save'
simplemeta_meta_form in ./simplemeta.module

File

./simplemeta.module, line 386

Code

function simplemeta_meta_form_submit_save($form, &$form_state) {
  $values = $form_state['values'];
  $meta = $values['_meta'];
  $meta->path = $values['_path'];
  $meta->data = array_intersect_key($values, simplemeta_get_form_elements());
  $info = simplemeta_get_info();
  foreach ($info as $key => $definition) {
    if (isset($definition['submit']) && function_exists($definition['submit'])) {
      $function = $definition['submit'];

      // @todo should we pass the $form? Think about
      $function($meta, $form_state);
    }
  }
  simplemeta_meta_save($meta);
  cache_clear_all('*', 'cache_simplemeta', TRUE);
  drupal_set_message(t('Meta has been saved'));
  if (!$form_state['values']['_ajax']) {
    $form_state['redirect'] = 'admin/content/simplemeta/list';
  }
}