You are here

function pmpapi_push_get_uname in Public Media Platform API Integration 7

Create a unique namespace for a given entity.

Since bundle names are not unique across entity types, and bundle name cannot always be easily divined from an entity object, we have this modest function.

Parameters

object $entity: Any drupal entity object

string $type: The type of entity (node, file, etc.)

Return value

string A unique namespace

4 calls to pmpapi_push_get_uname()
pmpapi_push_entity_insert in pmpapi_push/pmpapi_push.module
Implements hook_entity_insert().
pmpapi_push_entity_ok_to_push in pmpapi_push/pmpapi_push.module
Determines if an entity should be pushed to the PMP API.
pmpapi_push_entity_update in pmpapi_push/pmpapi_push.module
Implements hook_entity_update().
pmpapi_push_get_mapping_for_entity in pmpapi_push/pmpapi_push.module
Gets the field->attribute mapping for an entity.

File

pmpapi_push/pmpapi_push.module, line 204
Maps drupal entities to MPM profiles, and pushes them to the PMP API.

Code

function pmpapi_push_get_uname($entity, $type) {
  $wrapper = entity_metadata_wrapper($type, $entity);
  $bundle_name = $wrapper
    ->getBundle();
  return $type . '__' . $bundle_name;
}