You are here

function services_client_get_client_hooks_list in Services Client 7

This function will return a data for a single connection hook, or if the 'num' param is set to 'all', it will return an object containing all matches

Parameters

array $params: Params are: hid: a hook id (will always return 1 result) name: a hook name (will always return 1 result) conn_name: a connection name (can return many results) num: Number of results to return. Options are all or 1.

Return value

array|object

2 calls to services_client_get_client_hooks_list()
services_client_admin_list in ./services_client.admin.inc
List the all connections and hooks
services_client_hook_load in ./services_client.module
Load hook object by ID

File

./services_client.module, line 268
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_get_client_hooks_list($params = array()) {
  $ret = array();
  if (!empty($params['hid']) && is_numeric($params['hid'])) {
    $ret = db_query("SELECT * FROM {services_client_connection_hook} WHERE hid = ?", array(
      $params['hid'],
    ));
  }
  else {
    if (!empty($params['name']) && $params['name']) {
      $ret = db_query("SELECT * FROM {services_client_connection_hook} WHERE name = ?", array(
        $params['name'],
      ));
    }
    else {
      if (!empty($params['conn_name']) && $params['conn_name']) {
        $ret = db_query("SELECT * FROM {services_client_connection_hook} WHERE conn_name = ?", array(
          $params['conn_name'],
        ));
      }
      else {
        $ret = db_query("SELECT * FROM {services_client_connection_hook} WHERE 1");
      }
    }
  }
  if (!empty($ret)) {
    if (!empty($params['num']) && $params['num'] == 'all') {
      return $ret
        ->fetchAll();
    }
    else {
      return $ret
        ->fetchAssoc();
    }
  }
  else {
    return FALSE;
  }
}