diff --git a/core/modules/field/field.api.php b/core/modules/field/field.api.php index 5e6d4b6..38b02cd 100644 --- a/core/modules/field/field.api.php +++ b/core/modules/field/field.api.php @@ -1510,7 +1510,7 @@ function hook_field_storage_write(\Drupal\Core\Entity\EntityInterface $entity, $ * * This hook is invoked from field_attach_delete() to ask the field storage * module to delete field data. - + * * @param \Drupal\Core\Entity\EntityInterface $entity * The entity on which to operate. * @param $fields @@ -2184,7 +2184,7 @@ function hook_field_storage_purge(\Drupal\Core\Entity\EntityInterface $entity, $ * The operation to be performed. Possible values: 'edit', 'view'. * @param $field * The field on which the operation is to be performed. - * @param $entity + * @param \Drupal\Core\Entity\EntityInterface $entity * (optional) The entity for the operation. * @param $account * (optional) The account to check; if not given use currently logged in user. diff --git a/core/modules/field/field.multilingual.inc b/core/modules/field/field.multilingual.inc index c2e50d4..a9b33ac 100644 --- a/core/modules/field/field.multilingual.inc +++ b/core/modules/field/field.multilingual.inc @@ -303,14 +303,15 @@ function field_language(EntityInterface $entity, $field_name = NULL, $langcode = $display_langcodes = &drupal_static(__FUNCTION__, array()); $id = $entity->id(); $bundle = $entity->bundle(); + $entity_type = $entity->entityType(); $langcode = field_valid_language($langcode, FALSE); - if (!isset($display_langcodes[$entity->entityType()][$id][$langcode])) { + if (!isset($display_langcodes[$entity_type][$id][$langcode])) { $display_langcode = array(); // By default, display language is set to one of the locked languages // if the field translation is not available. It is up to translation // handlers to implement language fallback rules. - foreach (field_info_instances($entity->entityType(), $bundle) as $instance) { + foreach (field_info_instances($entity_type, $bundle) as $instance) { if (isset($entity->{$instance['field_name']}[$langcode])) { $display_langcode[$instance['field_name']] = $langcode; } @@ -328,23 +329,23 @@ function field_language(EntityInterface $entity, $field_name = NULL, $langcode = } } - if (field_has_translation_handler($entity->entityType())) { + if (field_has_translation_handler($entity_type)) { $context = array( 'entity' => $entity, 'langcode' => $langcode, ); // Do not apply core language fallback rules if they are disabled or if // the entity does not have a translation handler registered. - if (variable_get('field_language_fallback', FALSE) && field_has_translation_handler($entity->entityType())) { + if (variable_get('field_language_fallback', FALSE) && field_has_translation_handler($entity_type)) { field_language_fallback($display_langcode, $context['entity'], $context['langcode']); } drupal_alter('field_language', $display_langcode, $context); } - $display_langcodes[$entity->entityType()][$id][$langcode] = $display_langcode; + $display_langcodes[$entity_type][$id][$langcode] = $display_langcode; } - $display_langcode = $display_langcodes[$entity->entityType()][$id][$langcode]; + $display_langcode = $display_langcodes[$entity_type][$id][$langcode]; // Single-field mode. if (isset($field_name)) { diff --git a/core/modules/field_sql_storage/field_sql_storage.module b/core/modules/field_sql_storage/field_sql_storage.module index 4254c74..accca35 100644 --- a/core/modules/field_sql_storage/field_sql_storage.module +++ b/core/modules/field_sql_storage/field_sql_storage.module @@ -403,6 +403,7 @@ function field_sql_storage_field_storage_write(EntityInterface $entity, $op, $fi $vid = $entity->getRevisionId(); $id = $entity->id(); $bundle = $entity->bundle(); + $entity_type = $entity->entityType(); if (!isset($vid)) { $vid = $id; } @@ -413,7 +414,7 @@ function field_sql_storage_field_storage_write(EntityInterface $entity, $op, $fi $table_name = _field_sql_storage_tablename($field); $revision_name = _field_sql_storage_revision_tablename($field); - $all_langcodes = field_available_languages($entity->entityType(), $field); + $all_langcodes = field_available_languages($entity_type, $field); $field_langcodes = array_intersect($all_langcodes, array_keys((array) $entity->$field_name)); // Delete and insert, rather than update, in case a value was added. @@ -426,13 +427,13 @@ function field_sql_storage_field_storage_write(EntityInterface $entity, $op, $fi // of an entity. if ($entity->isDefaultRevision()) { db_delete($table_name) - ->condition('entity_type', $entity->entityType()) + ->condition('entity_type', $entity_type) ->condition('entity_id', $id) ->condition('langcode', $langcodes, 'IN') ->execute(); } db_delete($revision_name) - ->condition('entity_type', $entity->entityType()) + ->condition('entity_type', $entity_type) ->condition('entity_id', $id) ->condition('revision_id', $vid) ->condition('langcode', $langcodes, 'IN') @@ -456,7 +457,7 @@ function field_sql_storage_field_storage_write(EntityInterface $entity, $op, $fi // We now know we have someting to insert. $do_insert = TRUE; $record = array( - 'entity_type' => $entity->entityType(), + 'entity_type' => $entity_type, 'entity_id' => $id, 'revision_id' => $vid, 'bundle' => $bundle,