You are here

function sheetfield_spreadsheet_process in Sheetnode 5

1 string reference to 'sheetfield_spreadsheet_process'
sheetnode_elements in ./sheetnode.module
Implementation of FAPI hook_elements().

File

./sheetnode.module, line 550

Code

function sheetfield_spreadsheet_process($element, $edit, $form_state, $form) {
  $field_key = $element['#columns'][0];
  $delta = $element['#delta'];
  $value = isset($element['#default_value']) ? is_array($element['#default_value']) ? $element['#default_value']['value'] : $element['#default_value'] : (isset($element['#value'][$field_key]) && is_string($element['#value'][$field_key]) ? $element['#value'][$field_key] : '');
  $output = _sheetnode_inject($value, $element['#id'] . '-' . $field_key, isset($form['#node']) ? array(
    'entity-name' => 'node',
    'oid' => $form['#node']->nid,
  ) : NULL);
  $element['sheetview'] = array(
    '#value' => $output,
    '#weight' => -1,
  );
  $element[$field_key] = array(
    '#type' => 'hidden',
  );
  $element['#tree'] = TRUE;
  return $element;
}