You are here

function pmpapi_permissions_get_group_options in Public Media Platform API Integration 7

Fetches all PMP groups and creates an array (which can be used as a list of options in a form).

Return value

array A list of groups, where group guid is the index and group title is the value.

3 calls to pmpapi_permissions_get_group_options()
pmpapi_permissions_attach_perm_elements in pmpapi_permissions/pmpapi_permissions.module
Attaches any applicable permission elements to a given (entity CRUD) form.
pmpapi_permissions_form_file_entity_file_type_form_alter in pmpapi_permissions/pmpapi_permissions.module
Implements hook_form_FORM_ID_alter() for file_entity_file_type_form().
pmpapi_permissions_form_node_type_form_alter in pmpapi_permissions/pmpapi_permissions.module
Implements hook_form_FORM_ID_alter() for node_type_form().

File

pmpapi_permissions/pmpapi_permissions.module, line 23

Code

function pmpapi_permissions_get_group_options() {
  $options = array();
  $options[0] = t('All PMP users');
  $user_id = variable_get('pmpapi_user_id');
  $options[$user_id] = t('Only this user (private)');
  foreach (pmpapi_fetch_groups() as $group) {
    $options[$group->attributes->guid] = $group->attributes->title;
  }
  return $options;
}