diff --git a/includes/common.inc b/includes/common.inc index 5857aac6d8753466aadde8d34878c0d1b47ba7d2..1ec294288650c429c1d4674509a0ae8158f508b9 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; } diff --git a/includes/entity.inc b/includes/entity.inc index d4d19e6a27a39bab8bc93d8224aa722478d1abcb..4b6058b753bd82b4545a7f16f44ac71d76717b84 100644 --- a/includes/entity.inc +++ b/includes/entity.inc @@ -64,11 +64,11 @@ public function __construct($entityType) { $this->entityInfo = entity_get_info($entityType); $this->entityCache = array(); $this->hookLoadArguments = array(); - $this->idKey = $this->entityInfo['object keys']['id']; + $this->idKey = $this->entityInfo['entity keys']['id']; // Check if the entity type supports revisions. - if (!empty($this->entityInfo['object keys']['revision'])) { - $this->revisionKey = $this->entityInfo['object keys']['revision']; + if (!empty($this->entityInfo['entity keys']['revision'])) { + $this->revisionKey = $this->entityInfo['entity keys']['revision']; $this->revisionTable = $this->entityInfo['revision table']; } else { diff --git a/modules/comment/comment.install b/modules/comment/comment.install index 7b486b493afb7b8939a5b10d9e88c2a7f607483f..ad3ede220a3c8adeab19cf2fc33e549949042926 100644 --- a/modules/comment/comment.install +++ b/modules/comment/comment.install @@ -55,7 +55,7 @@ function comment_enable() { $field = array( 'field_name' => 'comment_body', 'type' => 'text_long', - 'object_types' => array('comment'), + 'entity_types' => array('comment'), ); field_create_field($field); } @@ -269,7 +269,7 @@ function comment_update_7012() { $field = array( 'field_name' => 'comment_body', 'type' => 'text_long', - 'object_types' => array('comment'), + 'entity_types' => array('comment'), ); field_create_field($field); @@ -277,7 +277,7 @@ function comment_update_7012() { $body_instance = array( 'field_name' => 'comment_body', 'label' => 'Comment', - 'object_type' => 'comment', + 'entity_type' => 'comment', 'settings' => array('text_processing' => 1), // Hide field label by default. 'display' => array( diff --git a/modules/comment/comment.module b/modules/comment/comment.module index c88ac3562742ce6d9a6b562796a3ba1c6f356acf..ab71b724bdbbad44e9276b4e8f6cfdd63f542ee3 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -100,7 +100,7 @@ function comment_entity_info() { 'uri callback' => 'comment_uri', 'fieldable' => TRUE, 'controller class' => 'CommentController', - 'object keys' => array( + 'entity keys' => array( 'id' => 'cid', 'bundle' => 'node_type', ), @@ -343,7 +343,7 @@ function _comment_body_field_instance_create($info) { $instance = array( 'field_name' => 'comment_body', 'label' => 'Comment', - 'object_type' => 'comment', + 'entity_type' => 'comment', 'bundle' => 'comment_node_' . $info->type, 'settings' => array('text_processing' => 1), 'required' => TRUE, diff --git a/modules/field/field.api.php b/modules/field/field.api.php index 92585935592fdaeb886e3fc5632f7d597f185fff..d8752ba628321c6cc0c23fac5d52de606333d65b 100644 --- a/modules/field/field.api.php +++ b/modules/field/field.api.php @@ -659,7 +659,7 @@ function hook_field_widget_info_alter(&$info) { * The order of this item in the array of subelements (0, 1, 2, etc). * @param $element * A form element array containing basic properties for the widget: - * - #object_type: The name of the entity the field is attached to. + * - #entity_type: The name of the entity the field is attached to. * - #bundle: The name of the field bundle the field is contained in. * - #field_name: The name of the field. * - #language: The language the field is being edited in. @@ -1023,7 +1023,7 @@ function hook_field_attach_update($entity_type, $entity) { * values. * @param $context * An associative array containing: - * - obj_type: The type of $entity; e.g. 'node' or 'user'. + * - entity_type: The type of $entity; e.g. 'node' or 'user'. * - object: The entity with fields to render. * - element: The structured array containing the values ready for rendering. */ @@ -1059,7 +1059,7 @@ function hook_field_attach_delete_revision($entity_type, $entity) { * The structured content array tree for all of $entity's fields. * @param $context * An associative array containing: - * - obj_type: The type of $entity; e.g. 'node' or 'user'. + * - entity_type: The type of $entity; e.g. 'node' or 'user'. * - object: The entity with fields to render. * - view_mode: View mode, e.g. 'full', 'teaser'... */ diff --git a/modules/field/field.attach.inc b/modules/field/field.attach.inc index 4122000c468a80f112c7787a705c4537272bf723..f177f535db6af0d03f1ed199503489f73609601b 100644 --- a/modules/field/field.attach.inc +++ b/modules/field/field.attach.inc @@ -186,7 +186,7 @@ function _field_invoke($op, $entity_type, $entity, &$a = NULL, &$b = NULL, $opti list(, , $bundle) = entity_extract_ids($entity_type, $entity); if ($options['deleted']) { - $instances = field_read_instances(array('object_type' => $entity_type, 'bundle' => $bundle), array('include_deleted' => $options['deleted'])); + $instances = field_read_instances(array('entity_type' => $entity_type, 'bundle' => $bundle), array('include_deleted' => $options['deleted'])); } else { $instances = field_info_instances($entity_type, $bundle); @@ -616,7 +616,7 @@ function field_attach_load($entity_type, $entities, $age = FIELD_LOAD_CURRENT, $ foreach ($queried_entities as $entity) { list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity); if ($options['deleted']) { - $instances = field_read_instances(array('object_type' => $entity_type, 'bundle' => $bundle), array('include_deleted' => $options['deleted'])); + $instances = field_read_instances(array('entity_type' => $entity_type, 'bundle' => $bundle), array('include_deleted' => $options['deleted'])); } else { $instances = field_info_instances($entity_type, $bundle); @@ -1188,7 +1188,7 @@ function field_attach_prepare_view($entity_type, $entities, $view_mode = 'full') * '#title' => the label of the field instance, * '#label_display' => the label display mode, * '#object' => the fieldable entity being displayed, - * '#object_type' => the type of the entity being displayed, + * '#entity_type' => the type of the entity being displayed, * '#language' => the language of the field values being displayed, * '#view_mode' => the view mode, * '#field_name' => the name of the field, @@ -1233,8 +1233,8 @@ function field_attach_view($entity_type, $entity, $view_mode = 'full', $langcode // Let other modules alter the renderable array. $context = array( - 'obj_type' => $entity_type, - 'object' => $entity, + 'entity_type' => $entity_type, + 'entity' => $entity, 'view_mode' => $view_mode, ); drupal_alter('field_attach_view', $output, $context); @@ -1278,8 +1278,8 @@ function field_attach_preprocess($entity_type, $entity, $element, &$variables) { // Let other modules make changes to the $variables array. $context = array( - 'obj_type' => $entity_type, - 'object' => $entity, + 'entity_type' => $entity_type, + 'entity' => $entity, 'element' => $element, ); drupal_alter('field_attach_preprocess', $variables, $context); @@ -1337,7 +1337,7 @@ function field_attach_create_bundle($entity_type, $bundle) { function field_attach_rename_bundle($entity_type, $bundle_old, $bundle_new) { db_update('field_config_instance') ->fields(array('bundle' => $bundle_new)) - ->condition('object_type', $entity_type) + ->condition('entity_type', $entity_type) ->condition('bundle', $bundle_old) ->execute(); diff --git a/modules/field/field.crud.inc b/modules/field/field.crud.inc index 7e631f04cc86b1fc6a8b87d1f689d8b9ab40fed6..e6c0122a3c309d766debf30549a2f810577b8c5b 100644 --- a/modules/field/field.crud.inc +++ b/modules/field/field.crud.inc @@ -45,7 +45,7 @@ * - type (string) * The type of the field, such as 'text' or 'image'. Field types * are defined by modules that implement hook_field_info(). - * - object_types (array) + * - entity_types (array) * The array of entity types that can hold instances of this field. If * empty or not specified, the field can have instances in any entity type. * - cardinality (integer) @@ -108,7 +108,7 @@ * It is populated automatically by field_create_instance(). * - field_name (string) * The name of the field attached to the bundle by this instance. - * - object_type (string) + * - entity_type (string) * The name of the entity type the instance is attached to. * - bundle (string) * The name of the bundle that the field is attached to. @@ -262,13 +262,13 @@ function field_create_field($field) { // collisions with existing entity properties, but some is better // than none. foreach (entity_get_info() as $type => $info) { - if (in_array($field['field_name'], $info['object keys'])) { + if (in_array($field['field_name'], $info['entity keys'])) { throw new FieldException(t('Attempt to create field name %name which is reserved by entity type %type.', array('%name' => $field['field_name'], '%type' => $type))); } } $field += array( - 'object_types' => array(), + 'entity_types' => array(), 'cardinality' => 1, 'translatable' => FALSE, 'locked' => FALSE, @@ -403,8 +403,8 @@ function field_update_field($field) { if ($field['type'] != $prior_field['type']) { throw new FieldException("Cannot change an existing field's type."); } - if ($field['object_types'] != $prior_field['object_types']) { - throw new FieldException("Cannot change an existing field's object_types property."); + if ($field['entity_types'] != $prior_field['entity_types']) { + throw new FieldException("Cannot change an existing field's entity_types property."); } if ($field['storage']['type'] != $prior_field['storage']['type']) { throw new FieldException("Cannot change an existing field's storage type."); @@ -588,7 +588,7 @@ function field_delete_field($field_name) { * Creates an instance of a field, binding it to a bundle. * * @param $instance - * A field instance definition array. The field_name, object_type and + * A field instance definition array. The field_name, entity_type and * bundle properties are required. Other properties, if omitted, * will be given the following default values: * - label: the field name @@ -620,15 +620,15 @@ function field_create_instance($instance) { throw new FieldException(t("Attempt to create an instance of a field @field_name that doesn't exist or is currently inactive.", array('@field_name' => $instance['field_name']))); } // Check that the required properties exists. - if (empty($instance['object_type'])) { + if (empty($instance['entity_type'])) { throw new FieldException(t('Attempt to create an instance of field @field_name without an object type.', array('@field_name' => $instance['field_name']))); } if (empty($instance['bundle'])) { throw new FieldException(t('Attempt to create an instance of field @field_name without a bundle.', array('@field_name' => $instance['field_name']))); } // Check that the field can be attached to this entity type. - if (!empty($field['object_types']) && !in_array($instance['object_type'], $field['object_types'])) { - throw new FieldException(t('Attempt to create an instance of field @field_name on forbidden object type @obj_type.', array('@field_name' => $instance['field_name'], '@obj_type' => $instance['object_type']))); + if (!empty($field['entity_types']) && !in_array($instance['entity_type'], $field['entity_types'])) { + throw new FieldException(t('Attempt to create an instance of field @field_name on forbidden object type @entity_type.', array('@field_name' => $instance['field_name'], '@entity_type' => $instance['entity_type']))); } // Set the field id. @@ -647,7 +647,7 @@ function field_create_instance($instance) { // Ensure the field instance is unique within the bundle. // We only check for instances of active fields, since adding an instance of // a disabled field is not supported. - $prior_instance = field_read_instance($instance['object_type'], $instance['field_name'], $instance['bundle']); + $prior_instance = field_read_instance($instance['entity_type'], $instance['field_name'], $instance['bundle']); if (!empty($prior_instance)) { $message = t('Attempt to create an instance of field @field_name on bundle @bundle that already has an instance of that field.', array('@field_name' => $instance['field_name'], '@bundle' => $instance['bundle'])); throw new FieldException($message); @@ -688,7 +688,7 @@ function field_update_instance($instance) { // Check that the field instance exists (even if it is inactive, since we // want to be able to replace inactive widgets with new ones). - $prior_instance = field_read_instance($instance['object_type'], $instance['field_name'], $instance['bundle'], array('include_inactive' => TRUE)); + $prior_instance = field_read_instance($instance['entity_type'], $instance['field_name'], $instance['bundle'], array('include_inactive' => TRUE)); if (empty($prior_instance)) { throw new FieldException("Attempt to update a field instance that doesn't exist."); } @@ -769,7 +769,7 @@ function _field_write_instance($instance, $update = FALSE) { $record = array( 'field_id' => $instance['field_id'], 'field_name' => $instance['field_name'], - 'object_type' => $instance['object_type'], + 'entity_type' => $instance['entity_type'], 'bundle' => $instance['bundle'], 'data' => $data, 'deleted' => $instance['deleted'], @@ -810,7 +810,7 @@ function _field_write_instance($instance, $update = FALSE) { * An instance structure, or FALSE. */ function field_read_instance($entity_type, $field_name, $bundle, $include_additional = array()) { - $instances = field_read_instances(array('object_type' => $entity_type, 'field_name' => $field_name, 'bundle' => $bundle), $include_additional); + $instances = field_read_instances(array('entity_type' => $entity_type, 'field_name' => $field_name, 'bundle' => $bundle), $include_additional); return $instances ? current($instances) : FALSE; } @@ -858,13 +858,13 @@ function field_read_instances($params = array(), $include_additional = array()) foreach ($results as $record) { // Filter out instances on unknown entity types (for instance because the // module exposing them was disabled). - $entity_info = entity_get_info($record['object_type']); + $entity_info = entity_get_info($record['entity_type']); if ($include_inactive || $entity_info) { $instance = unserialize($record['data']); $instance['id'] = $record['id']; $instance['field_id'] = $record['field_id']; $instance['field_name'] = $record['field_name']; - $instance['object_type'] = $record['object_type']; + $instance['entity_type'] = $record['entity_type']; $instance['bundle'] = $record['bundle']; $instance['deleted'] = $record['deleted']; @@ -886,7 +886,7 @@ function field_delete_instance($instance) { db_update('field_config_instance') ->fields(array('deleted' => 1)) ->condition('field_name', $instance['field_name']) - ->condition('object_type', $instance['object_type']) + ->condition('entity_type', $instance['entity_type']) ->condition('bundle', $instance['bundle']) ->execute(); diff --git a/modules/field/field.default.inc b/modules/field/field.default.inc index 4bdd2a83dd89e3833e659eae53b9e23b7c5a2f64..0af3d06c6d0b0c81c146177186398f38d59cb28c 100644 --- a/modules/field/field.default.inc +++ b/modules/field/field.default.inc @@ -203,7 +203,7 @@ function field_default_view($entity_type, $entity, $field, $instance, $langcode, '#field_name' => $field['field_name'], '#field_type' => $field['type'], '#field_translatable' => $field['translatable'], - '#object_type' => $entity_type, + '#entity_type' => $entity_type, '#bundle' => $bundle, '#object' => $entity, '#items' => $items, diff --git a/modules/field/field.form.inc b/modules/field/field.form.inc index 3e41b04085a1e47b404b1151c2478d6fbe8fb180..fd7bedbb4ff9ba34c1e085eb48336b5427cb37d6 100644 --- a/modules/field/field.form.inc +++ b/modules/field/field.form.inc @@ -50,7 +50,7 @@ function field_default_form($entity_type, $entity, $field, $instance, $langcode, $function = $instance['widget']['module'] . '_field_widget_form'; if (function_exists($function)) { $element = array( - '#object_type' => $instance['object_type'], + '#entity_type' => $instance['entity_type'], '#bundle' => $instance['bundle'], '#field_name' => $field_name, '#language' => $langcode, @@ -161,7 +161,7 @@ function field_multiple_value_form($field, $instance, $langcode, $items, &$form, for ($delta = 0; $delta <= $max; $delta++) { $multiple = $field['cardinality'] > 1 || $field['cardinality'] == FIELD_CARDINALITY_UNLIMITED; $element = array( - '#object_type' => $instance['object_type'], + '#entity_type' => $instance['entity_type'], '#bundle' => $instance['bundle'], '#field_name' => $field_name, '#language' => $langcode, diff --git a/modules/field/field.info.inc b/modules/field/field.info.inc index 7f911dc1cdaf3512884865a53403f65fa57a7f44..a4517684c4b052fb51cdb953b87054672f7ded5a 100644 --- a/modules/field/field.info.inc +++ b/modules/field/field.info.inc @@ -220,13 +220,13 @@ function _field_info_collate_fields($reset = FALSE) { foreach ($definitions['instances'] as $instance) { $field = $info['fields'][$instance['field_name']]; $instance = _field_info_prepare_instance($instance, $field); - $info['instances'][$instance['object_type']][$instance['bundle']][$instance['field_name']] = $instance; + $info['instances'][$instance['entity_type']][$instance['bundle']][$instance['field_name']] = $instance; // Enrich field definitions with the list of bundles where they have // instances. NOTE: Deleted fields in $info['field_ids'] are not // enriched because all of their instances are deleted, too, and // are thus not in $definitions['instances']. - $info['fields'][$instance['field_name']]['bundles'][$instance['object_type']][] = $instance['bundle']; - $info['field_ids'][$instance['field_id']]['bundles'][$instance['object_type']][] = $instance['bundle']; + $info['fields'][$instance['field_name']]['bundles'][$instance['entity_type']][] = $instance['bundle']; + $info['field_ids'][$instance['field_id']]['bundles'][$instance['entity_type']][] = $instance['bundle']; } } @@ -291,7 +291,7 @@ function _field_info_prepare_instance($instance, $field) { } // Fallback to 'full' display settings for unspecified view modes. - $entity_info = entity_get_info($instance['object_type']); + $entity_info = entity_get_info($instance['entity_type']); foreach ($entity_info['view modes'] as $view_mode => $info) { if (!isset($instance['display'][$view_mode])) { $instance['display'][$view_mode] = $instance['display']['full']; diff --git a/modules/field/field.install b/modules/field/field.install index 75724c4294a6465393f10b19611249d1f15162e7..3d23d2b6a95404c4a10319cacf205f351dceae60 100644 --- a/modules/field/field.install +++ b/modules/field/field.install @@ -130,7 +130,7 @@ function field_schema() { 'not null' => TRUE, 'default' => '' ), - 'object_type' => array( + 'entity_type' => array( 'type' => 'varchar', 'length' => 32, 'not null' => TRUE, @@ -158,7 +158,7 @@ function field_schema() { 'primary key' => array('id'), 'indexes' => array( // Used by field_delete_instance(). - 'field_name_bundle' => array('field_name', 'object_type', 'bundle'), + 'field_name_bundle' => array('field_name', 'entity_type', 'bundle'), // Used by field_read_instances(). 'deleted' => array('deleted'), ), diff --git a/modules/field/field.module b/modules/field/field.module index eb36649165755951759e3dff723b001e12ca34a8..c3765cfaa3d4e80b9aa4575651c2ad64e369bfd7 100644 --- a/modules/field/field.module +++ b/modules/field/field.module @@ -608,8 +608,8 @@ function field_view_field($entity_type, $entity, $field_name, $display = array() // Invoke hook_field_attach_view_alter() to let other modules alter the // renderable array, as in a full field_attach_view() execution. $context = array( - 'obj_type' => $entity_type, - 'object' => $entity, + 'entity_type' => $entity_type, + 'entity' => $entity, 'view_mode' => '_custom', ); drupal_alter('field_attach_view', $result, $context); diff --git a/modules/field/modules/field_sql_storage/field_sql_storage.module b/modules/field/modules/field_sql_storage/field_sql_storage.module index 2e7512627ab7749cc7b27ce694f63097812c287f..a768aa9c0140c82f3692dddbad5c24be509181ac 100644 --- a/modules/field/modules/field_sql_storage/field_sql_storage.module +++ b/modules/field/modules/field_sql_storage/field_sql_storage.module @@ -577,7 +577,7 @@ function field_sql_storage_field_storage_query($field_id, $conditions, $options) // If querying all revisions and the entity type has revisions, we need // to key the results by revision_ids. $entity_type = entity_get_info($row->type); - $id = ($load_current || empty($entity_type['object keys']['revision'])) ? $row->entity_id : $row->revision_id; + $id = ($load_current || empty($entity_type['entity keys']['revision'])) ? $row->entity_id : $row->revision_id; if (!isset($return[$row->type][$id])) { $return[$row->type][$id] = entity_create_stub_entity($row->type, array($row->entity_id, $row->revision_id, $row->bundle)); @@ -623,7 +623,7 @@ function field_sql_storage_field_storage_delete_revision($entity_type, $entity, * This function simply marks for deletion all data associated with the field. */ function field_sql_storage_field_storage_delete_instance($instance) { - $etid = _field_sql_storage_etid($instance['object_type']); + $etid = _field_sql_storage_etid($instance['entity_type']); $field = field_info_field($instance['field_name']); $table_name = _field_sql_storage_tablename($field); $revision_name = _field_sql_storage_revision_tablename($field); @@ -645,7 +645,7 @@ function field_sql_storage_field_storage_delete_instance($instance) { function field_sql_storage_field_attach_rename_bundle($entity_type, $bundle_old, $bundle_new) { $etid = _field_sql_storage_etid($entity_type); // We need to account for deleted or inactive fields and instances. - $instances = field_read_instances(array('object_type' => $entity_type, 'bundle' => $bundle_new), array('include_deleted' => TRUE, 'include_inactive' => TRUE)); + $instances = field_read_instances(array('entity_type' => $entity_type, 'bundle' => $bundle_new), array('include_deleted' => TRUE, 'include_inactive' => TRUE)); foreach ($instances as $instance) { $field = field_info_field_by_id($instance['field_id']); if ($field['storage']['type'] == 'field_sql_storage') { diff --git a/modules/field/modules/field_sql_storage/field_sql_storage.test b/modules/field/modules/field_sql_storage/field_sql_storage.test index 3a3522f2b738f8c29b0c632f113e77229835dffb..6af10a0b7ef7e0015ad9441114360da02e422621 100644 --- a/modules/field/modules/field_sql_storage/field_sql_storage.test +++ b/modules/field/modules/field_sql_storage/field_sql_storage.test @@ -28,7 +28,7 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase { $this->field = field_create_field($this->field); $this->instance = array( 'field_name' => $this->field_name, - 'object_type' => 'test_entity', + 'entity_type' => 'test_entity', 'bundle' => 'test_bundle' ); $this->instance = field_create_instance($this->instance); @@ -303,7 +303,7 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase { // Create a decimal 5.2 field and add some data. $field = array('field_name' => 'decimal52', 'type' => 'number_decimal', 'settings' => array('precision' => 5, 'scale' => 2)); $field = field_create_field($field); - $instance = array('field_name' => 'decimal52', 'object_type' => 'test_entity', 'bundle' => 'test_bundle'); + $instance = array('field_name' => 'decimal52', 'entity_type' => 'test_entity', 'bundle' => 'test_bundle'); $instance = field_create_instance($instance); $entity = field_test_create_stub_entity(0, 0, $instance['bundle']); $entity->decimal52[LANGUAGE_NONE][0]['value'] = '1.235'; @@ -329,7 +329,7 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase { $field_name = 'testfield'; $field = array('field_name' => $field_name, 'type' => 'text'); $field = field_create_field($field); - $instance = array('field_name' => $field_name, 'object_type' => 'test_entity', 'bundle' => 'test_bundle'); + $instance = array('field_name' => $field_name, 'entity_type' => 'test_entity', 'bundle' => 'test_bundle'); $instance = field_create_instance($instance); $tables = array(_field_sql_storage_tablename($field), _field_sql_storage_revision_tablename($field)); @@ -374,7 +374,7 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase { // Retrieve the field and instance with field_info so the storage details are attached. $field = field_info_field($this->field['field_name']); - $instance = field_info_instance($this->instance['object_type'], $this->instance['field_name'], $this->instance['bundle']); + $instance = field_info_instance($this->instance['entity_type'], $this->instance['field_name'], $this->instance['bundle']); // The storage details are indexed by a storage engine type. $this->assertTrue(array_key_exists('sql', $field['storage']['details']), t('The storage type is SQL.')); diff --git a/modules/field/modules/list/tests/list.test b/modules/field/modules/list/tests/list.test index 73c94a4a0e84f7422636eb19d6e2c266eed0e6b8..b4ab856c38def68a62b542122dd6bdaea3c0d179 100644 --- a/modules/field/modules/list/tests/list.test +++ b/modules/field/modules/list/tests/list.test @@ -34,7 +34,7 @@ class ListFieldTestCase extends FieldTestCase { $this->instance = array( 'field_name' => $this->field_name, - 'object_type' => 'test_entity', + 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', 'widget' => array( 'type' => 'options_buttons', @@ -82,7 +82,7 @@ class ListFieldTestCase extends FieldTestCase { $this->field = field_create_field($this->field); $this->instance = array( 'field_name' => $this->field_name, - 'object_type' => 'test_entity', + 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', 'widget' => array( 'type' => 'options_buttons', @@ -184,7 +184,7 @@ class ListFieldUITestCase extends FieldTestCase { field_create_field($field); $instance = array( 'field_name' => $field_name, - 'object_type' => 'node', + 'entity_type' => 'node', 'bundle' => $this->type, ); field_create_instance($instance); diff --git a/modules/field/modules/options/options.test b/modules/field/modules/options/options.test index 764c45c52bc74dbe1ddcbc8139c955784b80ee4b..2d441204a863f049442efaecbb8948fea0bb1cff 100644 --- a/modules/field/modules/options/options.test +++ b/modules/field/modules/options/options.test @@ -61,7 +61,7 @@ class OptionsWidgetsTestCase extends FieldTestCase { // Create an instance of the 'single value' field. $instance = array( 'field_name' => $this->card_1['field_name'], - 'object_type' => 'test_entity', + 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', 'widget' => array( 'type' => 'options_buttons', @@ -118,7 +118,7 @@ class OptionsWidgetsTestCase extends FieldTestCase { // Create an instance of the 'multiple values' field. $instance = array( 'field_name' => $this->card_2['field_name'], - 'object_type' => 'test_entity', + 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', 'widget' => array( 'type' => 'options_buttons', @@ -205,7 +205,7 @@ class OptionsWidgetsTestCase extends FieldTestCase { // Create an instance of the 'single value' field. $instance = array( 'field_name' => $this->card_1['field_name'], - 'object_type' => 'test_entity', + 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', 'widget' => array( 'type' => 'options_select', @@ -292,7 +292,7 @@ class OptionsWidgetsTestCase extends FieldTestCase { // Create an instance of the 'multiple values' field. $instance = array( 'field_name' => $this->card_2['field_name'], - 'object_type' => 'test_entity', + 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', 'widget' => array( 'type' => 'options_select', @@ -409,7 +409,7 @@ class OptionsWidgetsTestCase extends FieldTestCase { // Create an instance of the 'boolean' field. $instance = array( 'field_name' => $this->bool['field_name'], - 'object_type' => 'test_entity', + 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', 'widget' => array( 'type' => 'options_onoff', diff --git a/modules/field/modules/text/text.test b/modules/field/modules/text/text.test index 2a239e3be66e6acd3f9dcae5d84be0b63af25a00..6e9c41ac456fa2cbf431ca27a39bc746640268c7 100644 --- a/modules/field/modules/text/text.test +++ b/modules/field/modules/text/text.test @@ -40,7 +40,7 @@ class TextFieldTestCase extends DrupalWebTestCase { field_create_field($this->field); $this->instance = array( 'field_name' => $this->field['field_name'], - 'object_type' => 'test_entity', + 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', 'widget' => array( 'type' => 'text_textfield', @@ -86,7 +86,7 @@ class TextFieldTestCase extends DrupalWebTestCase { field_create_field($this->field); $this->instance = array( 'field_name' => $this->field_name, - 'object_type' => 'test_entity', + 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', 'label' => $this->randomName() . '_label', 'settings' => array( @@ -140,7 +140,7 @@ class TextFieldTestCase extends DrupalWebTestCase { field_create_field($this->field); $this->instance = array( 'field_name' => $this->field_name, - 'object_type' => 'test_entity', + 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', 'label' => $this->randomName() . '_label', 'settings' => array( diff --git a/modules/field/tests/field.test b/modules/field/tests/field.test index 8fa4820b4ab2121853c7ce5aa35f18d1f1e5cbd8..ed02a14f442d063c6b42b257229edba780461aac 100644 --- a/modules/field/tests/field.test +++ b/modules/field/tests/field.test @@ -78,7 +78,7 @@ class FieldAttachTestCase extends FieldTestCase { $this->field_id = $this->field['id']; $this->instance = array( 'field_name' => $this->field_name, - 'object_type' => 'test_entity', + 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', 'label' => $this->randomName() . '_label', 'description' => $this->randomName() . '_description', @@ -207,7 +207,7 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase { foreach ($field_bundles_map[$i] as $bundle) { $instance = array( 'field_name' => $field_names[$i], - 'object_type' => 'test_entity', + 'entity_type' => 'test_entity', 'bundle' => $bundles[$bundle], 'settings' => array( // Configure the instance so that we test hook_field_load() @@ -278,7 +278,7 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase { field_create_field($field); $instance = array( 'field_name' => $field['field_name'], - 'object_type' => 'test_entity', + 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', ); field_create_instance($instance); @@ -319,13 +319,13 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase { $field = field_create_field($field); $instance = array( 'field_name' => $field_name, - 'object_type' => 'test_entity', + 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', ); field_create_instance($instance); $field = field_info_field($instance['field_name']); - $instance = field_info_instance($instance['object_type'], $instance['field_name'], $instance['bundle']); + $instance = field_info_instance($instance['entity_type'], $instance['field_name'], $instance['bundle']); // The storage details are indexed by a storage engine type. $this->assertTrue(array_key_exists('drupal_variables', $field['storage']['details']), t('The storage type is Drupal variables.')); @@ -570,7 +570,7 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase { field_create_field($field); $instance = array( 'field_name' => $field_name, - 'object_type' => 'test_entity', + 'entity_type' => 'test_entity', 'bundle' => $this->instance['bundle'], 'label' => $this->randomName() . '_label', 'description' => $this->randomName() . '_description', @@ -626,10 +626,10 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase { // Create instances of both fields on the second entity type. $instance = $this->instance; - $instance['object_type'] = 'test_cacheable_entity'; + $instance['entity_type'] = 'test_cacheable_entity'; field_create_instance($instance); $instance2 = $this->instance2; - $instance2['object_type'] = 'test_cacheable_entity'; + $instance2['entity_type'] = 'test_cacheable_entity'; field_create_instance($instance2); // Unconditional count query returns 0. @@ -990,7 +990,7 @@ class FieldAttachOtherTestCase extends FieldAttachTestCase { $entity_type = 'test_cacheable_entity'; $cid = "field:$entity_type:{$entity_init->ftid}"; $instance = $this->instance; - $instance['object_type'] = $entity_type; + $instance['entity_type'] = $entity_type; field_create_instance($instance); // Check that no initial cache entry is present. @@ -1247,7 +1247,7 @@ class FieldInfoTestCase extends FieldTestCase { // Create an instance, verify that it shows up $instance = array( 'field_name' => $field['field_name'], - 'object_type' => 'test_entity', + 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', 'label' => $this->randomName(), 'description' => $this->randomName(), @@ -1306,7 +1306,7 @@ class FieldInfoTestCase extends FieldTestCase { field_create_field($field_definition); $instance_definition = array( 'field_name' => $field_definition['field_name'], - 'object_type' => 'test_entity', + 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', ); field_create_instance($instance_definition); @@ -1330,7 +1330,7 @@ class FieldInfoTestCase extends FieldTestCase { field_cache_clear(); // Read the instance back. - $instance = field_info_instance($instance_definition['object_type'], $instance_definition['field_name'], $instance_definition['bundle']); + $instance = field_info_instance($instance_definition['entity_type'], $instance_definition['field_name'], $instance_definition['bundle']); // Check that all expected instance settings are in place. $field_type = field_info_field_types($field_definition['type']); @@ -1363,7 +1363,7 @@ class FieldInfoTestCase extends FieldTestCase { field_create_field($field_definition); $instance_definition = array( 'field_name' => 'field', - 'object_type' => 'comment', + 'entity_type' => 'comment', 'bundle' => 'comment_node_article', ); field_create_instance($instance_definition); @@ -1415,7 +1415,7 @@ class FieldFormTestCase extends FieldTestCase { $this->field_unlimited = array('field_name' => drupal_strtolower($this->randomName()), 'type' => 'test_field', 'cardinality' => FIELD_CARDINALITY_UNLIMITED); $this->instance = array( - 'object_type' => 'test_entity', + 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', 'label' => $this->randomName() . '_label', 'description' => $this->randomName() . '_description', @@ -1711,7 +1711,7 @@ class FieldFormTestCase extends FieldTestCase { $field_name_no_access = $field_no_access['field_name']; $instance_no_access = array( 'field_name' => $field_name_no_access, - 'object_type' => 'test_entity', + 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', 'default_value' => array(0 => array('value' => 99)), ); @@ -1775,7 +1775,7 @@ class FieldDisplayAPITestCase extends FieldTestCase { ); $this->instance = array( 'field_name' => $this->field_name, - 'object_type' => 'test_entity', + 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', 'label' => $this->label, 'display' => array( @@ -2173,7 +2173,7 @@ class FieldCrudTestCase extends FieldTestCase { // Create instances for each. $this->instance_definition = array( 'field_name' => $this->field['field_name'], - 'object_type' => 'test_entity', + 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', 'widget' => array( 'type' => 'test_field_widget', @@ -2271,7 +2271,7 @@ class FieldCrudTestCase extends FieldTestCase { // Create a decimal 5.2 field. $field = array('field_name' => 'decimal53', 'type' => 'number_decimal', 'cardinality' => 3, 'settings' => array('precision' => 5, 'scale' => 2)); $field = field_create_field($field); - $instance = array('field_name' => 'decimal53', 'object_type' => 'test_entity', 'bundle' => 'test_bundle'); + $instance = array('field_name' => 'decimal53', 'entity_type' => 'test_entity', 'bundle' => 'test_bundle'); $instance = field_create_instance($instance); // Update it to a deciaml 5.3 field. @@ -2402,7 +2402,7 @@ class FieldInstanceCrudTestCase extends FieldTestCase { field_create_field($this->field); $this->instance_definition = array( 'field_name' => $this->field['field_name'], - 'object_type' => 'test_entity', + 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', ); } @@ -2464,7 +2464,7 @@ class FieldInstanceCrudTestCase extends FieldTestCase { $field_restricted = array( 'field_name' => drupal_strtolower($this->randomName()), 'type' => 'test_field', - 'object_types' => array('test_cacheable_entity'), + 'entity_types' => array('test_cacheable_entity'), ); field_create_field($field_restricted); @@ -2473,7 +2473,7 @@ class FieldInstanceCrudTestCase extends FieldTestCase { try { $instance = $this->instance_definition; $instance['field_name'] = $field_restricted['field_name']; - $instance['object_type'] = 'test_cacheable_entity'; + $instance['entity_type'] = 'test_cacheable_entity'; field_create_instance($instance); $this->pass(t('Can create an instance on an entity type allowed by the field.')); } @@ -2620,7 +2620,7 @@ class FieldTranslationsTestCase extends FieldTestCase { $this->field_name = drupal_strtolower($this->randomName() . '_field_name'); - $this->obj_type = 'test_entity'; + $this->entity_type = 'test_entity'; $field = array( 'field_name' => $this->field_name, @@ -2633,7 +2633,7 @@ class FieldTranslationsTestCase extends FieldTestCase { $instance = array( 'field_name' => $this->field_name, - 'object_type' => $this->obj_type, + 'entity_type' => $this->entity_type, 'bundle' => 'test_bundle', ); field_create_instance($instance); @@ -2660,7 +2660,7 @@ class FieldTranslationsTestCase extends FieldTestCase { // Test hook_field_languages() invocation on a translatable field. variable_set('field_test_field_available_languages_alter', TRUE); $enabled_languages = field_content_languages(); - $available_languages = field_available_languages($this->obj_type, $this->field); + $available_languages = field_available_languages($this->entity_type, $this->field); foreach ($available_languages as $delta => $langcode) { if ($langcode != 'xx' && $langcode != 'en') { $this->assertTrue(in_array($langcode, $enabled_languages), t('%language is an enabled language.', array('%language' => $langcode))); @@ -2672,7 +2672,7 @@ class FieldTranslationsTestCase extends FieldTestCase { // Test field_available_languages() behavior for untranslatable fields. $this->field['translatable'] = FALSE; $this->field_name = $this->field['field_name'] = $this->instance['field_name'] = drupal_strtolower($this->randomName() . '_field_name'); - $available_languages = field_available_languages($this->obj_type, $this->field); + $available_languages = field_available_languages($this->entity_type, $this->field); $this->assertTrue(count($available_languages) == 1 && $available_languages[0] === LANGUAGE_NONE, t('For untranslatable fields only LANGUAGE_NONE is available.')); } @@ -2687,7 +2687,7 @@ class FieldTranslationsTestCase extends FieldTestCase { // the result of field_available_languages(). $values = array(); $extra_languages = mt_rand(1, 4); - $languages = $available_languages = field_available_languages($this->obj_type, $this->field); + $languages = $available_languages = field_available_languages($this->entity_type, $this->field); for ($i = 0; $i < $extra_languages; ++$i) { $languages[] = $this->randomString(2); } @@ -2718,7 +2718,7 @@ class FieldTranslationsTestCase extends FieldTestCase { $entities = array(); $entity_type = 'test_entity'; $entity_count = mt_rand(1, 5); - $available_languages = field_available_languages($this->obj_type, $this->field); + $available_languages = field_available_languages($this->entity_type, $this->field); for ($id = 1; $id <= $entity_count; ++$id) { $entity = field_test_create_stub_entity($id, $id, $this->instance['bundle']); @@ -2809,7 +2809,7 @@ class FieldTranslationsTestCase extends FieldTestCase { $instance = array( 'field_name' => $field['field_name'], - 'object_type' => $entity_type, + 'entity_type' => $entity_type, 'bundle' => 'test_bundle', ); field_create_instance($instance); @@ -2938,7 +2938,7 @@ class FieldBulkDeleteTestCase extends FieldTestCase { foreach ($this->fields as $field) { $instance = array( 'field_name' => $field['field_name'], - 'object_type' => $this->entity_type, + 'entity_type' => $this->entity_type, 'bundle' => $bundle, 'widget' => array( 'type' => 'test_field_widget', diff --git a/modules/field/tests/field_test.entity.inc b/modules/field/tests/field_test.entity.inc index eef3dbf730f0900f81e60bc2aecca14b67af73ac..8c32602ea09d8d0eebb3c1f98a008c3a2e09de5f 100644 --- a/modules/field/tests/field_test.entity.inc +++ b/modules/field/tests/field_test.entity.inc @@ -23,7 +23,7 @@ function field_test_entity_info() { return array( 'test_entity' => array( 'name' => t('Test Entity'), - 'object keys' => array( + 'entity keys' => array( 'id' => 'ftid', 'revision' => 'ftvid', 'bundle' => 'fttype', @@ -36,7 +36,7 @@ function field_test_entity_info() { // This entity type doesn't get form handling for now... 'test_cacheable_entity' => array( 'name' => t('Test Entity, cacheable'), - 'object keys' => array( + 'entity keys' => array( 'id' => 'ftid', 'revision' => 'ftvid', 'bundle' => 'fttype', diff --git a/modules/field/tests/field_test.storage.inc b/modules/field/tests/field_test.storage.inc index 6ce2720408dff84e3c31641bab7de59afc60bb99..53259883277999788c19280e814276647c2739cf 100644 --- a/modules/field/tests/field_test.storage.inc +++ b/modules/field/tests/field_test.storage.inc @@ -323,7 +323,7 @@ function field_test_field_storage_query($field_id, $conditions, $count, &$cursor // If querying all revisions and the entity type has revisions, we need // to key the results by revision_ids. $entity_type = entity_get_info($row->type); - $id = ($load_current || empty($entity_type['object keys']['revision'])) ? $row->entity_id : $row->revision_id; + $id = ($load_current || empty($entity_type['entity keys']['revision'])) ? $row->entity_id : $row->revision_id; if (!isset($return[$row->type][$id])) { $return[$row->type][$id] = entity_create_stub_entity($row->type, array($row->entity_id, $row->revision_id, $row->bundle)); diff --git a/modules/field_ui/field_ui.admin.inc b/modules/field_ui/field_ui.admin.inc index 590396479bed090db092d662d0bfb35bd171caa7..ba892719276367c1eea1ea9866d63a679536434d 100644 --- a/modules/field_ui/field_ui.admin.inc +++ b/modules/field_ui/field_ui.admin.inc @@ -90,7 +90,7 @@ function field_ui_field_overview_form($form, &$form_state, $entity_type, $bundle $form += array( '#tree' => TRUE, - '#object_type' => $entity_type, + '#entity_type' => $entity_type, '#bundle' => $bundle, '#fields' => array_keys($instances), '#extra' => array_keys($extra), @@ -289,9 +289,9 @@ function template_preprocess_field_ui_field_overview_form(&$vars) { drupal_add_js(drupal_get_path('module', 'field_ui') . '/field_ui.js'); // Add settings for the update selects behavior. $js_fields = array(); - foreach (field_ui_existing_field_options($form['#object_type'], $form['#bundle']) as $field_name => $fields) { + foreach (field_ui_existing_field_options($form['#entity_type'], $form['#bundle']) as $field_name => $fields) { $field = field_info_field($field_name); - $instance = field_info_instance($form['#object_type'], $field_name, $form['#bundle']); + $instance = field_info_instance($form['#entity_type'], $field_name, $form['#bundle']); $js_fields[$field_name] = array('label' => $instance['label'], 'type' => $field['type'], 'widget' => $instance['widget']['type']); } drupal_add_js(array('fieldWidgetTypes' => field_ui_widget_type_options(), 'fields' => $js_fields), 'setting'); @@ -459,7 +459,7 @@ function _field_ui_field_overview_form_validate_add_existing($form, &$form_state */ function field_ui_field_overview_form_submit($form, &$form_state) { $form_values = $form_state['values']; - $entity_type = $form['#object_type']; + $entity_type = $form['#entity_type']; $bundle = $form['#bundle']; $admin_path = _field_ui_bundle_admin_path($entity_type, $bundle); @@ -497,7 +497,7 @@ function field_ui_field_overview_form_submit($form, &$form_state) { ); $instance = array( 'field_name' => $field['field_name'], - 'object_type' => $entity_type, + 'entity_type' => $entity_type, 'bundle' => $bundle, 'label' => $values['label'], 'widget' => array( @@ -532,7 +532,7 @@ function field_ui_field_overview_form_submit($form, &$form_state) { else { $instance = array( 'field_name' => $field['field_name'], - 'object_type' => $entity_type, + 'entity_type' => $entity_type, 'bundle' => $bundle, 'label' => $values['label'], 'widget' => array( @@ -580,7 +580,7 @@ function field_ui_display_overview_form($form, &$form_state, $entity_type, $bund $form += array( '#tree' => TRUE, - '#object_type' => $entity_type, + '#entity_type' => $entity_type, '#bundle' => $bundle, '#fields' => array_keys($instances), '#contexts' => $view_modes_selector, @@ -635,8 +635,8 @@ function template_preprocess_field_ui_display_overview_form(&$vars) { $form = &$vars['form']; $contexts_selector = $form['#contexts']; - $view_modes = field_ui_view_modes_tabs($form['#object_type'], $contexts_selector); - $entity_info = entity_get_info($form['#object_type']); + $view_modes = field_ui_view_modes_tabs($form['#entity_type'], $contexts_selector); + $entity_info = entity_get_info($form['#entity_type']); $view_modes_info = $entity_info['view modes']; $vars['contexts'] = array(); foreach ($view_modes as $view_mode) { @@ -677,7 +677,7 @@ function field_ui_display_overview_form_submit($form, &$form_state) { $form_values = $form_state['values']; foreach ($form_values as $key => $values) { if (in_array($key, $form['#fields'])) { - $instance = field_info_instance($form['#object_type'], $key, $form['#bundle']); + $instance = field_info_instance($form['#entity_type'], $key, $form['#bundle']); foreach ($instance['display'] as $view_mode => $display) { if (isset($values[$view_mode])) { $instance['display'][$view_mode] = array_merge($instance['display'][$view_mode], $values[$view_mode]); @@ -793,7 +793,7 @@ function field_ui_existing_field_options($entity_type, $bundle) { // - field that cannot be added to the entity type. if (empty($field['locked']) && !field_info_instance($entity_type, $field['field_name'], $bundle) - && (empty($field['object_types']) || in_array($entity_type, $field['object_types']))) { + && (empty($field['entity_types']) || in_array($entity_type, $field['entity_types']))) { $text = t('@type: @field (@label)', array( '@type' => $field_types[$field['type']]['label'], '@label' => t($instance['label']), '@field' => $instance['field_name'], @@ -860,7 +860,7 @@ function field_ui_field_settings_form($form, &$form_state, $entity_type, $bundle '#markup' => t('%field has no field settings.', array('%field' => $instance['label'])), ); } - $form['#object_type'] = $entity_type; + $form['#entity_type'] = $entity_type; $form['#bundle'] = $bundle; $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); @@ -878,7 +878,7 @@ function field_ui_field_settings_form_submit($form, &$form_state) { // Merge incoming form values into the existing field. $field = field_info_field($field_values['field_name']); - $entity_type = $form['#object_type']; + $entity_type = $form['#entity_type']; $bundle = $form['#bundle']; $instance = field_info_instance($entity_type, $field['field_name'], $bundle); @@ -940,7 +940,7 @@ function field_ui_widget_type_form_submit($form, &$form_state) { $form_values = $form_state['values']; $instance = $form['#instance']; $bundle = $instance['bundle']; - $entity_type = $instance['object_type']; + $entity_type = $instance['entity_type']; // Set the right module information. $widget_type = field_info_widget_types($form_values['widget_type']); @@ -967,7 +967,7 @@ function field_ui_field_delete_form($form, &$form_state, $entity_type, $bundle, $instance = field_info_instance($entity_type, $field['field_name'], $bundle); $admin_path = _field_ui_bundle_admin_path($entity_type, $bundle); - $form['object_type'] = array('#type' => 'value', '#value' => $entity_type); + $form['entity_type'] = array('#type' => 'value', '#value' => $entity_type); $form['bundle'] = array('#type' => 'value', '#value' => $bundle); $form['field_name'] = array('#type' => 'value', '#value' => $field['field_name']); @@ -994,7 +994,7 @@ function field_ui_field_delete_form_submit($form, &$form_state) { $form_values = $form_state['values']; $field_name = $form_values['field_name']; $bundle = $form_values['bundle']; - $entity_type = $form_values['object_type']; + $entity_type = $form_values['entity_type']; $field = field_info_field($field_name); $instance = field_info_instance($entity_type, $field_name, $bundle); @@ -1054,7 +1054,7 @@ function field_ui_field_edit_form($form, &$form_state, $entity_type, $bundle, $f '#type' => 'value', '#value' => $instance['field_name'], ); - $form['instance']['object_type'] = array( + $form['instance']['entity_type'] = array( '#type' => 'value', '#value' => $entity_type, ); @@ -1262,13 +1262,13 @@ function field_ui_field_edit_form_submit($form, &$form_state) { $instance['default_value'] = $items ? $items : NULL; // Update the instance settings. - $instance_source = field_info_instance($instance['object_type'], $instance['field_name'], $instance['bundle']); + $instance_source = field_info_instance($instance['entity_type'], $instance['field_name'], $instance['bundle']); $instance = array_merge($instance_source, $instance); field_update_instance($instance); drupal_set_message(t('Saved %label configuration.', array('%label' => $instance['label']))); - $form_state['redirect'] = field_ui_next_destination($instance['object_type'], $instance['bundle']); + $form_state['redirect'] = field_ui_next_destination($instance['entity_type'], $instance['bundle']); } /** diff --git a/modules/field_ui/field_ui.module b/modules/field_ui/field_ui.module index 9b1080c67213553ad9b4c2db8925baa16217061a..2642d80f3d94c6dde32dcd63c75a1ba8cbf48538 100644 --- a/modules/field_ui/field_ui.module +++ b/modules/field_ui/field_ui.module @@ -300,7 +300,7 @@ function field_ui_inactive_instances($entity_type, $bundle_name = NULL) { $inactive = array(); $params = array(); } - $params['object_type'] = $entity_type; + $params['entity_type'] = $entity_type; $active_instances = field_info_instances($entity_type); $all_instances = field_read_instances($params, array('include_inactive' => TRUE)); diff --git a/modules/field_ui/field_ui.test b/modules/field_ui/field_ui.test index 510a093565c3fda6e4453929968de07e7a6db598..e1bdc8185ad77b968479232ce030fc56897c8143 100644 --- a/modules/field_ui/field_ui.test +++ b/modules/field_ui/field_ui.test @@ -179,7 +179,7 @@ class FieldUITestCase extends DrupalWebTestCase { field_create_field($field); $instance = array( 'field_name' => $field_name, - 'object_type' => 'node', + 'entity_type' => 'node', 'bundle' => $this->type, ); field_create_instance($instance); diff --git a/modules/file/file.field.inc b/modules/file/file.field.inc index a304573b0aba14a297facc7f83be762c61b12919..57c47ae1e6fef3e7161b326e779656c759872cf2 100644 --- a/modules/file/file.field.inc +++ b/modules/file/file.field.inc @@ -246,7 +246,7 @@ function file_field_prepare_view($entity_type, $entities, $field, $instances, $l /** * Implements hook_field_presave(). */ -function file_field_presave($obj_type, $object, $field, $instance, $langcode, &$items) { +function file_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) { // Make sure that each file which will be saved with this object has a // permanent status, so that it will not be removed when temporary files are // cleaned up. diff --git a/modules/file/file.module b/modules/file/file.module index 0eba8471560932caba2ca0dea6231443a8ee3dd6..84a006dd680a793932f1fe11194718a4ac8718b3 100644 --- a/modules/file/file.module +++ b/modules/file/file.module @@ -915,7 +915,7 @@ function file_get_file_reference_count($file, $field = NULL, $field_type = NULL) if (isset($file->file_field_type) && isset($file->file_field_id)) { if ($file->file_field_type == $entity_type) { $info = entity_get_info($entity_type); - $id = $types[$entity_type]['object keys']['id']; + $id = $types[$entity_type]['entity keys']['id']; foreach ($type_references as $reference) { if ($file->file_field_id == $reference->$id) { $reference_count--; diff --git a/modules/file/tests/file.test b/modules/file/tests/file.test index 2a731ffd193676330be43de9a8f6551bb64edd51..7a9a140954cecc7fd4596a9ca8eb8f9b8dc04dfd 100644 --- a/modules/file/tests/file.test +++ b/modules/file/tests/file.test @@ -57,7 +57,7 @@ class FileFieldTestCase extends DrupalWebTestCase { $instance = array( 'field_name' => $field['field_name'], - 'object_type' => 'node', + 'entity_type' => 'node', 'label' => $name, 'bundle' => $type_name, 'required' => !empty($instance_settings['required']), diff --git a/modules/forum/forum.install b/modules/forum/forum.install index 5fb0cc9e8ef616875fbd2ea55fe04f89aea42371..5c4957cbb00d13b43a3f08bdfaea2f5a38939a49 100644 --- a/modules/forum/forum.install +++ b/modules/forum/forum.install @@ -55,7 +55,7 @@ function forum_enable() { $instance = array( 'field_name' => 'taxonomy_' . $vocabulary->machine_name, - 'object_type' => 'node', + 'entity_type' => 'node', 'label' => $vocabulary->name, 'bundle' => 'forum', 'widget' => array( diff --git a/modules/image/image.field.inc b/modules/image/image.field.inc index 55ba5c9396b6769e2121ae28ceb165889fabc77a..20c1294d4efcc850278f2c6efca3ded9c724be39 100644 --- a/modules/image/image.field.inc +++ b/modules/image/image.field.inc @@ -228,8 +228,8 @@ function image_field_prepare_view($entity_type, $entities, $field, $instances, $ /** * Implements hook_field_presave(). */ -function image_field_presave($obj_type, $object, $field, $instance, $langcode, &$items) { - file_field_presave($obj_type, $object, $field, $instance, $langcode, $items); +function image_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) { + file_field_presave($entity_type, $entity, $field, $instance, $langcode, $items); } /** diff --git a/modules/image/image.test b/modules/image/image.test index 54ca9084c742fdd5b238230f6f4321699ebc5537..99b8c50b93d2fffcb4e3dd60f8687975922284e1 100644 --- a/modules/image/image.test +++ b/modules/image/image.test @@ -543,7 +543,7 @@ class ImageFieldTestCase extends DrupalWebTestCase { $instance = array( 'field_name' => $field['field_name'], - 'object_type' => 'node', + 'entity_type' => 'node', 'label' => $name, 'bundle' => $type_name, 'required' => !empty($instance_settings['required']), diff --git a/modules/node/node.module b/modules/node/node.module index 1b5596be33cbdf23c08647f5eb8c978fecb70ba6..68a7c2f6dab08478c6dca110a905d9f533058bf6 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -183,7 +183,7 @@ function node_entity_info() { 'revision table' => 'node_revision', 'uri callback' => 'node_uri', 'fieldable' => TRUE, - 'object keys' => array( + 'entity keys' => array( 'id' => 'nid', 'revision' => 'vid', 'bundle' => 'type', @@ -563,7 +563,7 @@ function node_configure_fields($type) { $field = array( 'field_name' => 'body', 'type' => 'text_with_summary', - 'object_types' => array('node'), + 'entity_types' => array('node'), 'translatable' => TRUE, ); $field = field_create_field($field); @@ -571,7 +571,7 @@ function node_configure_fields($type) { if (empty($instance)) { $instance = array( 'field_name' => 'body', - 'object_type' => 'node', + 'entity_type' => 'node', 'bundle' => $type->type, 'label' => $type->body_label, 'widget_type' => 'text_textarea_with_summary', diff --git a/modules/rdf/rdf.module b/modules/rdf/rdf.module index cc18d5f412c91c4647b56e0d0e174016ea3189bf..03c153b8ee818b7504303666f9276fd2b3245b41 100644 --- a/modules/rdf/rdf.module +++ b/modules/rdf/rdf.module @@ -507,7 +507,7 @@ function rdf_preprocess_node(&$variables) { */ function rdf_preprocess_field(&$variables) { $element = $variables['element']; - $mapping = rdf_mapping_load($element['#object_type'], $element['#bundle']); + $mapping = rdf_mapping_load($element['#entity_type'], $element['#bundle']); $field_name = $element['#field_name']; if (!empty($mapping) && !empty($mapping[$field_name])) { diff --git a/modules/simpletest/tests/form.test b/modules/simpletest/tests/form.test index 4683fb8d4ebdf75ba585a5a6022f253c183b2470..76a9589bf4cfa66e20b48dc82e9ccb5caea7eb6a 100644 --- a/modules/simpletest/tests/form.test +++ b/modules/simpletest/tests/form.test @@ -946,7 +946,7 @@ class FormsArbitraryRebuildTestCase extends DrupalWebTestCase { field_create_field($field); $instance = array( - 'object_type' => 'node', + 'entity_type' => 'node', 'field_name' => 'test_multiple', 'bundle' => 'page', 'label' => 'Test a multiple valued field', diff --git a/modules/system/system.api.php b/modules/system/system.api.php index d248e3be9ee05018f1349bbe5292bed9bce68717..3bfa0e4b650458bf7e3d91c4bc0fa74e5d5a2dfa 100644 --- a/modules/system/system.api.php +++ b/modules/system/system.api.php @@ -70,7 +70,7 @@ function hook_hook_info() { * uri elements of the entity, e.g. 'path' and 'options'. The actual entity * uri can be constructed by passing these elements to url(). * - fieldable: Set to TRUE if you want your entity type to be fieldable. - * - object keys: An array describing how the Field API can extract the + * - entity keys: An array describing how the Field API can extract the * information it needs from the objects of the type. Elements: * - id: The name of the property that contains the primary id of the * object. Every object passed to the Field API must have this property @@ -97,7 +97,7 @@ function hook_hook_info() { * field_attach_load(). * - bundles: An array describing all bundles for this object type. * Keys are bundles machine names, as found in the objects' 'bundle' - * property (defined in the 'object keys' entry above). Elements: + * property (defined in the 'entity keys' entry above). Elements: * - label: The human-readable name of the bundle. * - admin: An array of information that allows Field UI pages to attach * themselves to the existing administration pages for the bundle. @@ -131,7 +131,7 @@ function hook_entity_info() { 'revision table' => 'node_revision', 'path callback' => 'node_path', 'fieldable' => TRUE, - 'object keys' => array( + 'entity keys' => array( 'id' => 'nid', 'revision' => 'vid', 'bundle' => 'type', @@ -1425,7 +1425,7 @@ function hook_mail($key, &$message, $params) { '%username' => format_username($account), ); if ($context['hook'] == 'taxonomy') { - $entity = $params['object']; + $entity = $params['entity']; $vocabulary = taxonomy_vocabulary_load($entity->vid); $variables += array( '%term_name' => $entity->name, diff --git a/modules/system/system.module b/modules/system/system.module index aa7ff01dbd8be850300d7d3ba70b8171d1fa413e..8f5b92e4ae62466fc00a1575986004dc550508e9 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -47,14 +47,14 @@ define('DRUPAL_REQUIRED', 2); /** - * Return only visible regions. + * Return only visible regions. * * @see system_region_list() */ define('REGIONS_VISIBLE', 'visible'); /** - * Return all regions. + * Return all regions. * * @see system_region_list() */ @@ -261,7 +261,7 @@ function system_entity_info() { 'file' => array( 'label' => t('File'), 'base table' => 'file', - 'object keys' => array( + 'entity keys' => array( 'id' => 'fid', ), 'static cache' => FALSE, diff --git a/modules/taxonomy/taxonomy.install b/modules/taxonomy/taxonomy.install index b47689ed52c0e5f4ac4ef260d21276060354deb5..96499e90907efd98ebd9cdfe3eb434ea4f9f274e 100644 --- a/modules/taxonomy/taxonomy.install +++ b/modules/taxonomy/taxonomy.install @@ -365,7 +365,7 @@ function taxonomy_update_7004() { 'label' => $vocabulary->name, 'field_name' => $field_name, 'bundle' => $bundle, - 'object_type' => 'node', + 'entity_type' => 'node', 'description' => $vocabulary->help, 'widget' => array( 'type' => $vocabulary->tags ? 'taxonomy_autocomplete' : 'select', diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index bee1627fffae3b750d899a540edc5ed5bcddcf25..9f6e54dc2caa7cb6ff550ea8ff1247f59db3690c 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -89,7 +89,7 @@ function taxonomy_entity_info() { 'base table' => 'taxonomy_term_data', 'uri callback' => 'taxonomy_term_uri', 'fieldable' => TRUE, - 'object keys' => array( + 'entity keys' => array( 'id' => 'tid', 'bundle' => 'vocabulary_machine_name', ), @@ -120,7 +120,7 @@ function taxonomy_entity_info() { 'label' => t('Taxonomy vocabulary'), 'controller class' => 'TaxonomyVocabularyController', 'base table' => 'taxonomy_vocabulary', - 'object keys' => array( + 'entity keys' => array( 'id' => 'vid', ), 'fieldable' => FALSE, diff --git a/modules/taxonomy/taxonomy.test b/modules/taxonomy/taxonomy.test index 4078d15f3e8d404241815c977b0068279aeb12ac..aa8b98335359dbb52daac665733472a12be0c7d9 100644 --- a/modules/taxonomy/taxonomy.test +++ b/modules/taxonomy/taxonomy.test @@ -342,7 +342,7 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase { $this->instance = array( 'field_name' => 'taxonomy_' . $this->vocabulary->machine_name, 'bundle' => 'article', - 'object_type' => 'node', + 'entity_type' => 'node', 'widget' => array( 'type' => 'options_select', ), @@ -761,7 +761,7 @@ class TaxonomyTermFieldTestCase extends TaxonomyWebTestCase { field_create_field($this->field); $this->instance = array( 'field_name' => $this->field_name, - 'object_type' => 'test_entity', + 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', 'widget' => array( 'type' => 'options_select', @@ -821,7 +821,7 @@ class TaxonomyTermFieldTestCase extends TaxonomyWebTestCase { field_create_field($this->field); $this->instance = array( 'field_name' => $this->field_name, - 'object_type' => 'test_entity', + 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', 'label' => $this->randomName() . '_label', 'widget' => array( @@ -894,7 +894,7 @@ class TaxonomyTokenReplaceTestCase extends TaxonomyWebTestCase { $this->instance = array( 'field_name' => 'taxonomy_' . $this->vocabulary->machine_name, 'bundle' => 'article', - 'object_type' => 'node', + 'entity_type' => 'node', 'widget' => array( 'type' => 'options_select', ), diff --git a/modules/user/user.module b/modules/user/user.module index 59badb5203ea08eff38196c7157c4a113ca97a86..772ddf5bb17b86bf7454aaef4d3e72907d949757 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -131,7 +131,7 @@ function user_entity_info() { 'base table' => 'users', 'uri callback' => 'user_uri', 'fieldable' => TRUE, - 'object keys' => array( + 'entity keys' => array( 'id' => 'uid', ), 'bundles' => array( diff --git a/profiles/standard/standard.install b/profiles/standard/standard.install index ff10e0b9c28f9f43de634dca3578da61fcee3a4a..75db91ec23534802d13b42fc2c777a3e0679795d 100644 --- a/profiles/standard/standard.install +++ b/profiles/standard/standard.install @@ -301,7 +301,7 @@ function standard_install() { $instance = array( 'field_name' => 'taxonomy_' . $vocabulary->machine_name, - 'object_type' => 'node', + 'entity_type' => 'node', 'label' => $vocabulary->name, 'bundle' => 'article', 'description' => $vocabulary->help, @@ -340,7 +340,7 @@ function standard_install() { // See http://api.drupal.org/api/function/field_create_instance/7 $instance = array( 'field_name' => 'field_image', - 'object_type' => 'node', + 'entity_type' => 'node', 'label' => 'Image', 'bundle' => 'article', 'description' => 'Upload an image to go with this article.',