You are here

function clients_fields in Web Service Clients 7

Same name and namespace in other branches
  1. 6 clients.module \clients_fields()

defines hook_clients_fields

2 calls to clients_fields()
clients_views_views_data in clients/clients_views/clients_views.module
FeedsClientsParser::getMappingSources in clients/clients_feeds/FeedsClientsParser.inc
Return mapping sources.

File

./clients.module, line 343
Clients module - handles keys and service connections and provides an API for clients

Code

function clients_fields($resource = NULL) {
  $fields = module_invoke_all('clients_fields', $resource);

  // module_invoke_all performs an array_merge_recursive. This flattens out multiple fields with same name to use the first value
  $result = array();
  foreach ($fields as $field => $val) {
    if (is_array($val['name'])) {
      $val['name'] = $val['name'][0];
      $val['description'] = $val['description'][0];
    }
    $result[$field] = $val;
  }
  return $result;
}