You are here

function metatags_get_entity_metatags in Metatag 7

Generate the metatags for a given entity.

Parameters

object $entity_id: The entity id of the entity to generate the metatags for.

string $entity_type: The entity type of the entity to generate the metatags for.

string $langcode: The language code used for rendering the entity.

Return value

array A renderable array of metatags for the given entity.

File

./metatag.module, line 1353
Primary hook implementations for Metatag.

Code

function metatags_get_entity_metatags($entity_id, $entity_type, $langcode = NULL) {
  $entities = entity_load($entity_type, array(
    $entity_id,
  ));
  $entity = reset($entities);
  return !empty($entity) ? metatag_generate_entity_metatags($entity, $entity_type, $langcode) : array();
}