You are here

function editablefields_cck_form_submit in Editable Fields 6.3

Submit handler for fields. EDITABLE

File

plugins/editables/cck.inc, line 61

Code

function editablefields_cck_form_submit($form, &$form_state) {
  $nids = explode(',', trim($form_state['values']['nids'], ','));
  $nids = array_unique($nids);
  $replacements = $additions = $deletions = array();
  $field = $form['#field_info'][$form_state['_params']['field_name']];
  foreach ($nids as $nid) {
    if ($node = node_load($nid, NULL, TRUE)) {
      $old_values = $node->{$field['field_name']};
      $new_values = $form_state['values'][$field['field_name']];
      $node->{$field['field_name']} = $new_values;
      $node = node_submit($node);
      node_save($node);

      // TODO: what's this for?  do we need it
      $content_set_empty = content_set_empty($field, $new_values);
      $replacements[$nid] = array(
        'field' => $field,
        'item' => $node->{$field['field_name']},
        'object' => $node,
      );
    }
  }
  $form_state += array(
    'replacements' => $replacements,
  );
}