From a5e3956cba10de10a201772c1fde86d828304c35 Mon Sep 17 00:00:00 2001 From: xjm <xjm@65776.no-reply.drupal.org> Date: Sat, 27 Jan 2018 02:58:35 -0600 Subject: [PATCH] Revert "Issue #2939909 by plach, Wim Leers: Ensure that hook_bundle_info_alter() implementations know whether bundles are translatable" This reverts commit c9392bb31191a72816ab6c769b5dbb8d6aa2ec90. --- .../content_translation.module | 8 --- .../a_content_translation_test.info.yml | 10 --- .../a_content_translation_test.module | 13 ---- ...ContentTranslationEntityBundleInfoTest.php | 61 ------------------- 4 files changed, 92 deletions(-) delete mode 100644 core/modules/content_translation/tests/modules/a_content_translation_test/a_content_translation_test.info.yml delete mode 100644 core/modules/content_translation/tests/modules/a_content_translation_test/a_content_translation_test.module delete mode 100644 core/modules/content_translation/tests/src/Kernel/ContentTranslationEntityBundleInfoTest.php diff --git a/core/modules/content_translation/content_translation.module b/core/modules/content_translation/content_translation.module index b7bd079dcc34..48feccc6cd25 100644 --- a/core/modules/content_translation/content_translation.module +++ b/core/modules/content_translation/content_translation.module @@ -60,14 +60,6 @@ function content_translation_module_implements_alter(&$implementations, $hook) { unset($implementations['content_translation']); $implementations['content_translation'] = $group; break; - - // Move our hook_entity_bundle_info_alter() implementation to the top of the - // list, so that any other hook implementation can rely on bundles being - // correctly marked as translatable. - case 'entity_bundle_info_alter': - $group = $implementations['content_translation']; - $implementations = ['content_translation' => $group] + $implementations; - break; } } diff --git a/core/modules/content_translation/tests/modules/a_content_translation_test/a_content_translation_test.info.yml b/core/modules/content_translation/tests/modules/a_content_translation_test/a_content_translation_test.info.yml deleted file mode 100644 index f2df57c31cb1..000000000000 --- a/core/modules/content_translation/tests/modules/a_content_translation_test/a_content_translation_test.info.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: 'A content translation test module' -type: module -description: 'Helper module to test hook invocation order.' -package: Testing -version: VERSION -core: 8.x -dependencies: - - content_translation - - entity_test - diff --git a/core/modules/content_translation/tests/modules/a_content_translation_test/a_content_translation_test.module b/core/modules/content_translation/tests/modules/a_content_translation_test/a_content_translation_test.module deleted file mode 100644 index b89e16037aec..000000000000 --- a/core/modules/content_translation/tests/modules/a_content_translation_test/a_content_translation_test.module +++ /dev/null @@ -1,13 +0,0 @@ -<?php - -/** - * @file - * Helper module for the Content Translation tests. - */ - -/** - * Implements hook_entity_bundle_info_alter(). - */ -function a_content_translation_test_entity_bundle_info_alter(&$bundles) { - \Drupal::state()->set('a_content_translation_test.translatable', !empty($bundles['entity_test_mul']['entity_test_mul']['translatable'])); -} diff --git a/core/modules/content_translation/tests/src/Kernel/ContentTranslationEntityBundleInfoTest.php b/core/modules/content_translation/tests/src/Kernel/ContentTranslationEntityBundleInfoTest.php deleted file mode 100644 index 1fa3a91c8bce..000000000000 --- a/core/modules/content_translation/tests/src/Kernel/ContentTranslationEntityBundleInfoTest.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php - -namespace Drupal\Tests\content_translation\Kernel; - -use Drupal\KernelTests\KernelTestBase; - -/** - * Tests the Content Translation bundle info logic. - * - * @group content_translation - */ -class ContentTranslationEntityBundleInfoTest extends KernelTestBase { - - /** - * {@inheritdoc} - */ - public static $modules = ['user', 'language', 'a_content_translation_test', 'content_translation', 'entity_test']; - - /** - * The content translation manager. - * - * @var \Drupal\content_translation\ContentTranslationManagerInterface - */ - protected $contentTranslationManager; - - /** - * The bundle info service. - * - * @var \Drupal\Core\Entity\EntityTypeBundleInfo - */ - protected $bundleInfo; - - /** - * {@inheritdoc} - */ - protected function setUp() { - parent::setUp(); - - $this->contentTranslationManager = $this->container->get('content_translation.manager'); - $this->bundleInfo = $this->container->get('entity_type.bundle.info'); - - $this->installEntitySchema('entity_test_mul'); - } - - /** - * Tests that modules can know whether bundles are translatable. - */ - public function testHookInvocationOrder() { - $this->contentTranslationManager->setEnabled('entity_test_mul', 'entity_test_mul', TRUE); - $this->bundleInfo->clearCachedBundles(); - $this->bundleInfo->getAllBundleInfo(); - - // Check that, although the "a_content_translation_test" hook implementation - // by default would be invoked first, it still has access to the - // "translatable" bundle info property. - /** @var \Drupal\Core\State\StateInterface $state */ - $state = $this->container->get('state'); - $this->assertTrue($state->get('a_content_translation_test.translatable')); - } - -} -- GitLab