You are here

function profile_update_8003 in Profile 8

Removes the langcode key from the profile entity keys.

File

./profile.install, line 79
Install, update and uninstall functions for the profile module.

Code

function profile_update_8003() {
  $definition_update_manager = \Drupal::entityDefinitionUpdateManager();
  $profile_entity_type = $definition_update_manager
    ->getEntityType('profile');
  if ($profile_entity_type
    ->hasKey('langcode')) {
    $keys = $profile_entity_type
      ->getKeys();
    unset($keys['langcode']);
    $profile_entity_type
      ->set('entity_keys', $keys);
    $definition_update_manager
      ->updateEntityType($profile_entity_type);
  }
  return t('Language code key removed from profile entity definition.');
}