diff --git a/core/modules/file/file.module b/core/modules/file/file.module index 538d121..625375d 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -7,11 +7,9 @@ use Drupal\file\Entity\File; use Drupal\Component\Utility\NestedArray; +use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\Core\Template\Attribute; -use Symfony\Component\HttpFoundation\JsonResponse; use Drupal\file\FileUsage\FileUsageInterface; -use Drupal\Core\Ajax\AjaxResponse; -use Drupal\Core\Ajax\ReplaceCommand; // Load all Field module hooks for File. require_once __DIR__ . '/file.field.inc'; @@ -621,7 +619,7 @@ function file_file_download($uri, $field_type = 'file') { } // Find out which (if any) fields of this type contain the file. - $references = file_get_file_references($file, NULL, FIELD_LOAD_CURRENT, $field_type); + $references = file_get_file_references($file, NULL, EntityStorageControllerInterface::FIELD_LOAD_CURRENT, $field_type); // Stop processing if there are no references in order to avoid returning // headers for files controlled by other modules. Make an exception for @@ -1827,8 +1825,10 @@ function file_icon_map(File $file) { * reference check to the given field. * @param $age * (optional) A constant that specifies which references to count. Use - * FIELD_LOAD_REVISION to retrieve all references within all revisions or - * FIELD_LOAD_CURRENT to retrieve references only in the current revisions. + * EntityStorageControllerInterface::FIELD_LOAD_REVISION to retrieve all + * references within all revisions or + * EntityStorageControllerInterface::FIELD_LOAD_CURRENT to retrieve references + * only in the current revisions. * @param $field_type * (optional) The name of a field type. If given, limits the reference check * to fields of the given type. If both $field and $field_type is given but @@ -1839,7 +1839,7 @@ function file_icon_map(File $file) { * A multidimensional array. The keys are field_name, entity_type, * entity_id and the value is an entity referencing this file. */ -function file_get_file_references(File $file, $field = NULL, $age = FIELD_LOAD_REVISION, $field_type = 'file') { +function file_get_file_references(File $file, $field = NULL, $age = EntityStorageControllerInterface::FIELD_LOAD_REVISION, $field_type = 'file') { $references = &drupal_static(__FUNCTION__, array()); $field_columns = &drupal_static(__FUNCTION__ . ':field_columns', array()); @@ -1853,7 +1853,7 @@ function file_get_file_references(File $file, $field = NULL, $age = FIELD_LOAD_R // The usage table contains usage of every revision. If we are looking // for every revision or the entity does not support revisions then // every usage is already a match. - $match_entity_type = $age == FIELD_LOAD_REVISION || !isset($entity_info['entity_keys']['revision']); + $match_entity_type = $age == EntityStorageControllerInterface::FIELD_LOAD_REVISION || !isset($entity_info['entity_keys']['revision']); $entities = entity_load_multiple($entity_type, array_keys($entity_ids)); foreach ($entities as $entity) { $bundle = $entity->bundle(); diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php index e1b0ea7..166d615 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php @@ -7,6 +7,7 @@ namespace Drupal\system\Tests\Entity; +use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\Core\Language\Language; /** @@ -250,7 +251,7 @@ function testEntityQuery() { $this->assertResult(); $this->queryResults = $this->factory->get('entity_test_mulrev') ->condition("$greetings.value", 'merhaba') - ->age(FIELD_LOAD_REVISION) + ->age(EntityStorageControllerInterface::FIELD_LOAD_REVISION) ->sort('revision_id') ->execute(); // Bit 2 needs to be set. @@ -280,7 +281,7 @@ function testEntityQuery() { $this->assertIdentical($results, array_slice($assert, 4, 8, TRUE)); $results = $this->factory->get('entity_test_mulrev') ->condition("$greetings.value", 'a', 'ENDS_WITH') - ->age(FIELD_LOAD_REVISION) + ->age(EntityStorageControllerInterface::FIELD_LOAD_REVISION) ->sort('id') ->execute(); // Now we get everything.