function content_translation_entity_bundle_info_alter
Same name in other branches
- 9 core/modules/content_translation/content_translation.module \content_translation_entity_bundle_info_alter()
- 8.9.x core/modules/content_translation/content_translation.module \content_translation_entity_bundle_info_alter()
- 10 core/modules/content_translation/content_translation.module \content_translation_entity_bundle_info_alter()
Implements hook_entity_bundle_info_alter().
File
-
core/
modules/ content_translation/ content_translation.module, line 247
Code
function content_translation_entity_bundle_info_alter(&$bundles) {
/** @var \Drupal\content_translation\ContentTranslationManagerInterface $content_translation_manager */
$content_translation_manager = \Drupal::service('content_translation.manager');
foreach ($bundles as $entity_type_id => &$info) {
foreach ($info as $bundle => &$bundle_info) {
$bundle_info['translatable'] = $content_translation_manager->isEnabled($entity_type_id, $bundle);
if ($bundle_info['translatable'] && $content_translation_manager instanceof BundleTranslationSettingsInterface) {
$settings = $content_translation_manager->getBundleTranslationSettings($entity_type_id, $bundle);
// If pending revision support is enabled for this bundle, we need to
// hide untranslatable field widgets, otherwise changes in pending
// revisions might be overridden by changes in later default revisions.
$bundle_info['untranslatable_fields.default_translation_affected'] = !empty($settings['untranslatable_fields_hide']) || ContentTranslationManager::isPendingRevisionSupportEnabled($entity_type_id, $bundle);
}
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.