You are here

function _draggableviews_node_set_value in DraggableViews 6

Same name and namespace in other branches
  1. 6.2 draggableviews.inc \_draggableviews_node_set_value()
1 call to _draggableviews_node_set_value()
draggableviews_view_draggabletable_form_submit in ./draggableviews.inc
Implementing hook_submit

File

./draggableviews.inc, line 427
Implements preprocess function hook_submit for draggable views

Code

function _draggableviews_node_set_value(&$node, $field_name, $field_type, $value) {

  // get field
  if (isset($node->{$field_name})) {
    $field =& $node->{$field_name};
  }
  else {

    // return if field does not exist
    return;
  }
  if (!isset($value)) {

    // sometimes there is no value available (e.g. a root without a parent)
    // set empty array
    $field = array();
  }

  //differ between certain field types
  switch ($field_type) {
    case 'nodereference':
      $field[0]['nid'] = $value;
      break;
    default:
    case 'number_integer':
      $field[0]['value'] = $value;
      break;
  }
}