You are here

function pmpapi_fetch_groups in Public Media Platform API Integration 7

Fetches multiple PMP groups from the API.

Return value

array A list of PMP group docs.

2 calls to pmpapi_fetch_groups()
pmpapi_groups_list in pmpapi_groups/pmpapi_groups.admin.inc
Form constructor for the PMPAPI groups list form.
pmpapi_permissions_get_group_options in pmpapi_permissions/pmpapi_permissions.module
Fetches all PMP groups and creates an array (which can be used as a list of options in a form).

File

./pmpapi.module, line 244
Creates basic calls to the PMP API.

Code

function pmpapi_fetch_groups() {
  $pmp = new PMPAPIDrupal();
  $params = array(
    'limit' => 1000,
    'profile' => 'group',
    'writeable' => 'true',
  );
  $pmp
    ->pull($params);
  if (empty($pmp->errors) && !empty($pmp->query->results->docs)) {
    return $pmp->query->results->docs;
  }
  return array();
}