You are here

function services_client_process_mapping_prepare_empty in Services Client 7

Creates empty mapping of fields

Parameters

array $empty: List of empty fields

3 calls to services_client_process_mapping_prepare_empty()
services_client_make_node_call in ./services_client.module
Make the actual node create/update call for each connection and task
services_client_make_submission_to_node_call in ./services_client.module
Make the actual node create/update call for each connection and task
services_client_make_user_call in ./services_client.module
Make the actual user create/update call for each connection and task

File

./services_client.module, line 924
Services client module allows to push different types of objects on different types of events such as node_save, user_save to remote masters.

Code

function services_client_process_mapping_prepare_empty($empty) {
  $output = array();

  // Split textarea to rows
  $rows = is_array($empty) ? $empty : explode("\n", trim($empty));
  foreach ($rows as $row) {
    $row = trim($row);
    if (!empty($row)) {

      // Get source field, (destination), default value
      $data = explode("|", $row);

      // source|destination|value or source|value
      $output[$data[0]] = array(
        'destination' => isset($data[2]) ? $data[1] : NULL,
        'value' => isset($data[2]) ? $data[2] : $data[1],
      );
      if ($output[$data[0]]['value'] == "NULL") {
        $output[$data[0]]['value'] = NULL;
      }
      if ($output[$data[0]]['value'] == "ARRAY") {
        $output[$data[0]]['value'] = array();
      }
    }
  }
  return $output;
}