function content_translation_test_entity_bundle_info_alter

Same name and namespace in other branches
  1. 8.9.x core/modules/content_translation/tests/modules/content_translation_test/content_translation_test.module \content_translation_test_entity_bundle_info_alter()
  2. 10 core/modules/content_translation/tests/modules/content_translation_test/content_translation_test.module \content_translation_test_entity_bundle_info_alter()
  3. 11.x core/modules/content_translation/tests/modules/content_translation_test/content_translation_test.module \content_translation_test_entity_bundle_info_alter()

Implements hook_entity_bundle_info_alter().

File

core/modules/content_translation/tests/modules/content_translation_test/content_translation_test.module, line 16

Code

function content_translation_test_entity_bundle_info_alter(&$bundles) {
    // Store the initial status of the "translatable" property for the
    // "entity_test_mul" bundle.
    $translatable = !empty($bundles['entity_test_mul']['entity_test_mul']['translatable']);
    \Drupal::state()->set('content_translation_test.translatable', $translatable);
    // Make it translatable if Content Translation did not. This will make the
    // entity object translatable even if it is disabled in Content Translation
    // settings.
    if (!$translatable) {
        $bundles['entity_test_mul']['entity_test_mul']['translatable'] = TRUE;
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.