You are here

function services_ccc_node_send in Services Client 7

Get the remote connections listed in the node and send to them

Parameters

object $node:

Return value

boolean

2 calls to services_ccc_node_send()
services_ccc_node_insert in services_ccc/services_ccc.module
Implementation of hook_node_insert()
services_ccc_node_update in services_ccc/services_ccc.module
Implementation of hook_node_updaet()

File

services_ccc/services_ccc.module, line 53

Code

function services_ccc_node_send($node) {
  $vocab_field = variable_get('services_ccc_connection_taxonomy', NULL);
  $conns_to_send = array();

  // If the vocab field is not set, then bail.
  if (!$vocab_field) {
    return;
  }

  // Get our tids from the node
  if (isset($node->{$vocab_field})) {
    $lang = field_language('node', $node, $vocab_field);
    foreach ($node->{$vocab_field}[$lang] as $num => $term) {
      $conns_to_send[] = taxonomy_term_load($term['tid'])->name;
    }
  }

  // We have cons, lets send to those bad boys
  if (!empty($conns_to_send)) {
    services_client_data_process($node, 'node_save', NULL, $conns_to_send, TRUE);
  }
}