You are here

function tablefield_replace_csv_values in TableField 7.3

Replace table field values with the values that were saved.

Helper function that uses recursion to replace table field values from $form_state['values'] with the values that were saved right after the csv upload.

The function is used if the size of the table is so large, that on the form submission the max_input_vars is exceeded.

Parameters

array $destination: It should only contain the $form_state['values'].

array $keys: Array with the nested keys of the field's location into $form_state['values'].

array $value: The table to be placed.

1 call to tablefield_replace_csv_values()
tablefield_field_widget_form_validate in ./tablefield.module
Form validation callback.

File

./tablefield.module, line 1781
Provides a set of fields that can be used to store tabular data with a node.

Code

function tablefield_replace_csv_values(array &$destination, array &$keys, array $value) {
  $cur_key = array_shift($keys);
  if (!isset($destination[$cur_key])) {
    return;
  }
  if (!empty($keys)) {
    tablefield_replace_csv_values($destination[$cur_key], $keys, $value);
    return;
  }
  foreach ($value as $key => $value2) {
    $destination[$cur_key][$key] = $value2;
  }
}