You are here

function hook_services_client_data_alter in Services Client 7

This hooks allows to alter source object which is going to be mapped to data sent via services. Use this hook to introduce new properties that can be easily mapped to remote objects.

Parameters

$object: Object that should be altered.

$type: String representation of object type

  • 'user'
  • 'node'
1 invocation of hook_services_client_data_alter()
services_client_data_process in ./services_client.module
This function takes inbound data objects and a type and determines if there are tasks for them. If there are, it checks conditions and then generates connections and organizes the data to pass to the calling functions

File

./services_client.api.php, line 21
Services client allows you to push different objects from local drupal installation to remote servers via REST api.

Code

function hook_services_client_data_alter(&$src_data, &$data_type) {
  if (isset($src_data->type) && $src_data->type == 'si_search_core') {

    // Test if the $object_input is the one we want
    $new_field_value = 'foo';

    // We can create new fields randomly and use the mappings as a tool

    //to map this new value to an existing field in this content type on the request side
    $src_data->field_new_field['und']['0']['value'] = $new_field_value;
  }
}