You are here

function node_field_node_submit in Node Field 7.2

Implements hook_node_submit().

File

./node_field.module, line 252
This module provide ability to add extra fields to any single node.

Code

function node_field_node_submit($node, $form, &$form_state) {
  if (isset($form_state['values']['node_fields'])) {
    drupal_alter('node_field_node_submit', $form_state);
    foreach ($form_state['values']['node_fields'] as $fid => $value) {
      if (!empty($form_state['node_fields'][$fid])) {
        $field = $form_state['node_fields'][$fid];

        // Text field with formats.
        if ($field['type'] == 'text_long' && is_array($value)) {
          $field['value'] = $value['value'];
          $field['settings']['text_format'] = $value['format'];
        }
        else {
          $field['value'] = $value;
        }
        node_field_update_node_field($field);
      }
    }
  }
}