You are here

function xmlsitemap_entity_extract_ids in XML sitemap 6.2

Backport of entity_extract_ids() from Drupal 7.

1 call to xmlsitemap_entity_extract_ids()
xmlsitemap_entity_uri in ./xmlsitemap.module
Backport of entity_uri() from Drupal 7.

File

./xmlsitemap.module, line 1637
Main file for the xmlsitemap module.

Code

function xmlsitemap_entity_extract_ids($entity_type, $entity) {
  $info = xmlsitemap_get_link_info($entity_type);

  // Objects being created might not have an id yet.
  $id = isset($entity->{$info['entity keys']['id']}) ? $entity->{$info['entity keys']['id']} : NULL;

  // If no bundle key provided, then we assume a single bundle, named after the
  // entity type.
  $bundle = $info['entity keys']['bundle'] ? $entity->{$info['entity keys']['bundle']} : $entity_type;
  return array(
    $id,
    NULL,
    $bundle,
  );
}