You are here

function file_entity_update_8005 in File Entity (fieldable files) 8.2

Fix the last installed definition for the 'file' entity type.

File

./file_entity.install, line 191
Install, update and uninstall functions for the file_entity module.

Code

function file_entity_update_8005() {
  $entity_type = \Drupal::entityDefinitionUpdateManager()
    ->getEntityType('file');
  $keys = $entity_type
    ->getKeys();
  if (empty($keys['bundle'])) {
    $keys['bundle'] = 'type';
    $entity_type
      ->set('entity_keys', $keys);
    \Drupal::entityDefinitionUpdateManager()
      ->updateEntityType($entity_type);
  }
}