From 7d4b84b8789ffd3ad22dc987860f46c18f9d0f07 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Sat, 27 Mar 2010 05:52:50 +0000 Subject: #707724 follow-up by yched: Fix more confusing field/entity api arguments. --- includes/common.inc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'includes/common.inc') diff --git a/includes/common.inc b/includes/common.inc index 5857aac6d..1ec294288 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -6251,11 +6251,11 @@ function entity_get_info($entity_type = NULL) { 'load hook' => $name . '_load', 'bundles' => array(), 'view modes' => array(), - 'object keys' => array(), + 'entity keys' => array(), 'cacheable' => TRUE, 'translation' => array(), ); - $entity_info[$name]['object keys'] += array( + $entity_info[$name]['entity keys'] += array( 'revision' => '', 'bundle' => '', ); @@ -6306,11 +6306,11 @@ function entity_info_cache_clear() { function entity_extract_ids($entity_type, $entity) { $info = entity_get_info($entity_type); // Objects being created might not have id/vid yet. - $id = isset($entity->{$info['object keys']['id']}) ? $entity->{$info['object keys']['id']} : NULL; - $vid = ($info['object keys']['revision'] && isset($entity->{$info['object keys']['revision']})) ? $entity->{$info['object keys']['revision']} : NULL; + $id = isset($entity->{$info['entity keys']['id']}) ? $entity->{$info['entity keys']['id']} : NULL; + $vid = ($info['entity keys']['revision'] && isset($entity->{$info['entity keys']['revision']})) ? $entity->{$info['entity keys']['revision']} : NULL; // If no bundle key provided, then we assume a single bundle, named after the // entity type. - $bundle = $info['object keys']['bundle'] ? $entity->{$info['object keys']['bundle']} : $entity_type; + $bundle = $info['entity keys']['bundle'] ? $entity->{$info['entity keys']['bundle']} : $entity_type; $cacheable = $info['cacheable']; return array($id, $vid, $bundle, $cacheable); } @@ -6334,12 +6334,12 @@ function entity_extract_ids($entity_type, $entity) { function entity_create_stub_entity($entity_type, $ids) { $entity = new stdClass(); $info = entity_get_info($entity_type); - $entity->{$info['object keys']['id']} = $ids[0]; - if (isset($info['object keys']['revision']) && !is_null($ids[1])) { - $entity->{$info['object keys']['revision']} = $ids[1]; + $entity->{$info['entity keys']['id']} = $ids[0]; + if (isset($info['entity keys']['revision']) && !is_null($ids[1])) { + $entity->{$info['entity keys']['revision']} = $ids[1]; } - if ($info['object keys']['bundle']) { - $entity->{$info['object keys']['bundle']} = $ids[2]; + if ($info['entity keys']['bundle']) { + $entity->{$info['entity keys']['bundle']} = $ids[2]; } return $entity; } -- cgit v1.2.3