You are here

function views_entity_test_entity_load in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/tests/modules/views_entity_test/views_entity_test.module \views_entity_test_entity_load()

Implements hook_entity_load().

See also

\Drupal\Tests\views\Kernel\Handler\FieldFieldTest::testSimpleExecute()

File

core/modules/views/tests/modules/views_entity_test/views_entity_test.module, line 54
Contains main module functionality.

Code

function views_entity_test_entity_load(array $entities, $entity_type_id) {
  if ($entity_type_id === 'entity_test') {

    // Cast the value of an entity field to be something else than a string so
    // we can check that
    // \Drupal\views\Tests\ViewResultAssertionTrait::assertIdenticalResultsetHelper()
    // takes care of converting all field values to strings.
    foreach ($entities as $entity) {
      $entity->user_id->target_id = (int) $entity->user_id->target_id;
    }
  }
}