You are here

function node_field_node_update in Node Field 7.2

Implements hook_node_update().

Allows to change node fields param in code. Use node_field_get_node_fields and node_fields_set_node_fields functions.

File

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

Code

function node_field_node_update($node) {
  if (user_access('add/edit/delete fields to node')) {
    if (!node_field_is_node_fields_changed($node)) {
      return;
    }
    $node_fields = node_field_get_node_fields($node);
    foreach ($node_fields as $field) {
      if (!empty($field['delete'])) {
        node_field_delete_node_field($field);
      }
      elseif (!empty($field['id'])) {
        node_field_update_node_field($field);
      }
      else {
        node_field_create_node_field($field);
      }
    }
  }
}