You are here

function pmpapi_permissions_extract_guid_from_form in Public Media Platform API Integration 7

Extracts a GUID from a form containing an entity that has been or will be pushed to the PMP.

$form array A Drupal form array.

$entity_type string The type of the entity contained within the form.

Return value

string The GUID of the entity contained within the form.

1 call to pmpapi_permissions_extract_guid_from_form()
pmpapi_permissions_attach_perm_elements in pmpapi_permissions/pmpapi_permissions.module
Attaches any applicable permission elements to a given (entity CRUD) form.

File

pmpapi_permissions/pmpapi_permissions.module, line 310

Code

function pmpapi_permissions_extract_guid_from_form($form, $entity_type) {
  $indexes = array(
    'node' => '#node',
    'file' => '#entity',
  );
  $index = $indexes[$entity_type];
  if (!empty($form[$index]->pmpapi_guid)) {
    return $form[$index]->pmpapi_guid;
  }
}