function metatag_metatags_load in Metatag 7
Load an entity's tags.
Parameters
string $entity_type: The entity type to load.
int $entity_id: The ID of the entity to load.
mixed $revision_id: Optional revision ID to load instead of the entity ID.
Return value
array An array of tag data keyed by language for the entity's current active revision.
5 calls to metatag_metatags_load()
- MetatagCoreNodeTest::testEntityCreationWorkflow in tests/MetatagCoreNodeTest.test 
- Tests creation of a standard entity.
- metatag_bulk_revert_batch_operation in ./metatag.admin.inc 
- Batch callback: delete custom metatags for selected bundles.
- metatag_feeds_set_target in ./metatag.feeds.inc 
- Callback function to set value of a metatag tag.
- metatag_importer_for_page_title in metatag_importer/metatag_importer.page_title.inc 
- Migrate data from the page_title table, if available.
- metatag_importer_metatags_quick_process in metatag_importer/metatag_importer.metatags_quick.inc 
- Process a row from Metatags Quick.
File
- ./metatag.module, line 593 
- Primary hook implementations for Metatag.
Code
function metatag_metatags_load($entity_type, $entity_id, $revision_id = NULL) {
  // A specific revision ID was not requested, so get the active revision ID.
  if (is_null($revision_id)) {
    // Unfortunately, the only way of getting the active revision ID is to
    // first load the entity, and then extract the ID. This is a bit
    // performance intensive, but it seems to be the only way of doing it.
    $entities = entity_load($entity_type, array(
      $entity_id,
    ));
    if (!empty($entities[$entity_id])) {
      // We only care about the revision_id.
      list(, $revision_id, ) = entity_extract_ids($entity_type, $entities[$entity_id]);
    }
  }
  // This returns an array nested by the entity ID, the revision ID and the
  // langcode.
  $metatags = metatag_metatags_load_multiple($entity_type, array(
    $entity_id,
  ), array(
    $revision_id,
  ));
  // Look for records for the requested revision ID.
  if (isset($metatags[$entity_id][$revision_id])) {
    return $metatags[$entity_id][$revision_id];
  }
  // Getting to this point means that no meta tags were identified earlier, so
  // return an empty array.
  return array();
}