You are here

function content_translation_language_content_settings_update in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/content_translation/content_translation.module \content_translation_language_content_settings_update()
  2. 10 core/modules/content_translation/content_translation.module \content_translation_language_content_settings_update()

Implements hook_ENTITY_TYPE_update().

Installs Content Translation's field storage definitions for the target entity type, if required.

Also clears the bundle information cache so that the bundle's translatability will be changed properly.

See also

content_translation_entity_bundle_info_alter()

\Drupal\content_translation\ContentTranslationManager::isEnabled()

File

core/modules/content_translation/content_translation.module, line 207
Allows entities to be translated into different languages.

Code

function content_translation_language_content_settings_update(ContentLanguageSettingsInterface $settings) {
  $original_settings = $settings->original;
  if ($settings
    ->getThirdPartySetting('content_translation', 'enabled', FALSE) && !$original_settings
    ->getThirdPartySetting('content_translation', 'enabled', FALSE)) {
    _content_translation_install_field_storage_definitions($settings
      ->getTargetEntityTypeId());
  }
  \Drupal::service('entity_type.bundle.info')
    ->clearCachedBundles();
}