Improved, though backwards compatible i18n_object_info(), now takes property as optio...
authorJose Reyero
Thu, 19 May 2011 16:54:00 +0000 (18:54 +0200)
committerJose Reyero
Thu, 19 May 2011 16:54:00 +0000 (18:54 +0200)
i18n.module

index a1869b6..c647f87 100644 (file)
@@ -309,13 +309,16 @@ function i18n_object_langcode($object, $default = FALSE, $field = 'language') {
 /**
  * Get translation information for objects
  */
-function i18n_object_info($type = NULL) {
+function i18n_object_info($type = NULL, $property = NULL) {
   $info = &drupal_static(__FUNCTION__);
   if (!$info) {
     $info = module_invoke_all('i18n_object_info');
     drupal_alter('i18n_object_info', $info);
   }
-  if ($type) {
+  if ($property) {
+    return isset($info[$type][$property]) ? $info[$type][$property] : NULL;
+  }
+  elseif ($type) {
     return isset($info[$type]) ? $info[$type] : array();
   }
   else {