function pathauto_entity_language in Pathauto 7
Returns the language code of the given entity.
Backward compatibility layer to ensure that installations running an older version of core where entity_language() is not available do not break.
Parameters
string $entity_type: An entity type.
object $entity: An entity object.
bool $check_language_property: A boolean if TRUE, will attempt to fetch the language code from $entity->language if the entity_language() function failed or does not exist. Default is TRUE.
5 calls to pathauto_entity_language()
- pathauto_form_node_form_alter in ./
pathauto.module - Implements hook_form_BASE_FORM_ID_alter().
- pathauto_form_taxonomy_form_term_alter in ./
pathauto.module - Implements hook_form_FORM_ID_alter().
- pathauto_node_update_alias in ./
pathauto.module - Update the URL aliases for an individual node.
- pathauto_taxonomy_term_update_alias in ./
pathauto.module - Update the URL aliases for an individual taxonomy term.
- pathauto_user_update_alias in ./
pathauto.module - Update the URL aliases for an individual user account.
File
- ./
pathauto.module, line 554 - Main file for the Pathauto module, which automatically generates aliases for content.
Code
function pathauto_entity_language($entity_type, $entity, $check_language_property = TRUE) {
$langcode = NULL;
if (function_exists('entity_language')) {
$langcode = entity_language($entity_type, $entity);
}
elseif ($check_language_property && !empty($entity->language)) {
$langcode = $entity->language;
}
return !empty($langcode) ? $langcode : LANGUAGE_NONE;
}