Loading hreflang.module +0 −14 Changes for hreflang.module: 0 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -8,20 +8,6 @@ use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Url; /** * Implements hook_module_implements_alter(). */ function hreflang_module_implements_alter(&$implementations, $hook) { // @fixme https://www.drupal.org/project/drupal/issues/1255092 // Content Translation module normally adds identical hreflang tags, so // executing its hook_page_attachments() implementation would be harmless, but // if an entity page is configured as the front page, it attaches extraneous // hreflang tags using the entity URL. if ($hook === 'page_attachments' && isset($implementations['content_translation'])) { unset($implementations['content_translation']); } } /** * Implements hook_page_attachments(). */ Loading tests/src/Functional/HreflangContentTranslationTest.php +4 −0 Changes for tests/src/Functional/HreflangContentTranslationTest.php: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -52,6 +52,10 @@ class HreflangContentTranslationTest extends NodeTestBase { $this->assertSession()->responseContains('<link rel="alternate" hreflang="en" href="' . $base_url . '/" />'); // French hreflang found on English page. $this->assertSession()->responseContains('<link rel="alternate" hreflang="fr" href="' . $base_url . '/fr" />'); // Delete this once we stop testing on older versions. if (version_compare(\Drupal::VERSION, '9.1', '<')) { $this->markTestSkipped('The issue being tested here was fixed in core 9.1.x; skip tests on older versions of core.'); } // English hreflang found on English page. $this->assertSession()->responseNotContains('<link rel="alternate" hreflang="en" href="' . $base_url . '/node/1" />'); // French hreflang found on English page. Loading Loading
hreflang.module +0 −14 Changes for hreflang.module: 0 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -8,20 +8,6 @@ use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Url; /** * Implements hook_module_implements_alter(). */ function hreflang_module_implements_alter(&$implementations, $hook) { // @fixme https://www.drupal.org/project/drupal/issues/1255092 // Content Translation module normally adds identical hreflang tags, so // executing its hook_page_attachments() implementation would be harmless, but // if an entity page is configured as the front page, it attaches extraneous // hreflang tags using the entity URL. if ($hook === 'page_attachments' && isset($implementations['content_translation'])) { unset($implementations['content_translation']); } } /** * Implements hook_page_attachments(). */ Loading
tests/src/Functional/HreflangContentTranslationTest.php +4 −0 Changes for tests/src/Functional/HreflangContentTranslationTest.php: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -52,6 +52,10 @@ class HreflangContentTranslationTest extends NodeTestBase { $this->assertSession()->responseContains('<link rel="alternate" hreflang="en" href="' . $base_url . '/" />'); // French hreflang found on English page. $this->assertSession()->responseContains('<link rel="alternate" hreflang="fr" href="' . $base_url . '/fr" />'); // Delete this once we stop testing on older versions. if (version_compare(\Drupal::VERSION, '9.1', '<')) { $this->markTestSkipped('The issue being tested here was fixed in core 9.1.x; skip tests on older versions of core.'); } // English hreflang found on English page. $this->assertSession()->responseNotContains('<link rel="alternate" hreflang="en" href="' . $base_url . '/node/1" />'); // French hreflang found on English page. Loading