Skip to content

Commit 77e1d03

Browse files
author
catch
committed
Issue #3507866 by plopesc, m4olivei, ckrina, berdir, catch: Enable the Navigation Top Bar when Navigation is enabled
1 parent 5c25b64 commit 77e1d03

12 files changed

+21
-158
lines changed

modules/navigation/modules/navigation_top_bar/navigation_top_bar.info.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: Navigation Top Bar
22
type: module
3-
description: 'When enabled, this module provides relevant administrative information and tasks for the current page on a top bar. It is not feature complete nor fully functional so enabling it could lead to possible inconsistencies.'
3+
description: 'Obsolete. All the functionality has been moved to the navigation module.'
44
package: Core (Experimental)
5-
lifecycle: experimental
5+
lifecycle: obsolete
6+
lifecycle_link: 'https://www.drupal.org/docs/core-modules-and-themes/deprecated-and-obsolete#s-understanding-obsolete-extensions'
67
version: VERSION
78
dependencies:
89
- navigation:navigation

modules/navigation/modules/navigation_top_bar/src/Hook/NavigationTopBarHooks.php

-34
This file was deleted.

modules/navigation/modules/navigation_top_bar/tests/src/Functional/GenericTest.php

-14
This file was deleted.

modules/navigation/navigation.post_update.php

+11
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,14 @@ function navigation_post_update_navigation_user_links_menu(array &$sandbox): voi
6060
'locked' => TRUE,
6161
])->save();
6262
}
63+
64+
/**
65+
* Uninstall the navigation_top_bar module if installed.
66+
*
67+
* @see https://www.drupal.org/project/drupal/issues/3507866
68+
*/
69+
function navigation_post_update_uninstall_navigation_top_bar(): void {
70+
if (\Drupal::moduleHandler()->moduleExists('navigation_top_bar')) {
71+
\Drupal::service('module_installer')->uninstall(['navigation_top_bar'], FALSE);
72+
}
73+
}

modules/navigation/src/NavigationRenderer.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,6 @@ protected function getContentTop(): array {
204204
* @see hook_page_top()
205205
*/
206206
public function buildTopBar(array &$page_top): void {
207-
if (!$this->moduleHandler->moduleExists('navigation_top_bar')) {
208-
return;
209-
}
210-
211207
$page_top['top_bar'] = [
212208
'#type' => 'top_bar',
213209
'#access' => $this->currentUser->hasPermission('access navigation'),
@@ -236,7 +232,7 @@ public function removeLocalTasks(array &$build, BlockPluginInterface $block): vo
236232
if ($block->getPluginId() !== 'local_tasks_block') {
237233
return;
238234
}
239-
if ($this->hasLocalTasks() && $this->moduleHandler->moduleExists('navigation_top_bar')) {
235+
if ($this->hasLocalTasks()) {
240236
$build['#access'] = FALSE;
241237
}
242238
}

modules/navigation/tests/src/Functional/NavigationShortcutsBlockTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,13 @@ public function testNavigationBlock(): void {
116116
$this->drupalLogin($site_configuration_user1);
117117
$this->verifyDynamicPageCache($test_page_url, 'MISS');
118118
$this->verifyDynamicPageCache($test_page_url, 'HIT');
119-
$this->assertCacheContexts(['user', 'url.query_args:_wrapper_format', 'session']);
119+
$this->assertCacheContexts(['user', 'url.query_args:_wrapper_format', 'session', 'route']);
120120
$this->assertSession()->pageTextContains('Shortcuts');
121121
$this->assertSession()->linkExists('Cron');
122122

123123
$this->drupalLogin($site_configuration_user2);
124124
$this->verifyDynamicPageCache($test_page_url, 'HIT');
125-
$this->assertCacheContexts(['user', 'url.query_args:_wrapper_format', 'session']);
125+
$this->assertCacheContexts(['user', 'url.query_args:_wrapper_format', 'session', 'route']);
126126
$this->assertSession()->pageTextContains('Shortcuts');
127127
$this->assertSession()->linkExists('Cron');
128128

modules/navigation/tests/src/Functional/NavigationTopBarContentModerationTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class NavigationTopBarContentModerationTest extends ModerationStateTestBase {
2525
protected static $modules = [
2626
'content_moderation',
2727
'node',
28-
'navigation_top_bar',
28+
'navigation',
2929
];
3030

3131
/**

modules/navigation/tests/src/Functional/NavigationTopBarPageContextTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class NavigationTopBarPageContextTest extends BrowserTestBase {
2626
protected static $modules = [
2727
'node',
2828
'navigation',
29-
'navigation_top_bar',
3029
'test_page_test',
3130
];
3231

modules/navigation/tests/src/Functional/NavigationTopBarTest.php

+1-15
Original file line numberDiff line numberDiff line change
@@ -85,21 +85,7 @@ public function testTopBarVisibility(): void {
8585
$this->verifyDynamicPageCache($test_page_url, 'HIT');
8686
$this->assertSession()->elementNotExists('xpath', "//div[contains(@class, 'top-bar__content')]/div[contains(@class, 'top-bar__actions')]/button");
8787

88-
$this->verifyDynamicPageCache($this->node->toUrl(), 'MISS');
89-
$this->verifyDynamicPageCache($this->node->toUrl(), 'HIT');
90-
// Top Bar is not visible if the feature flag module is disabled.
91-
$this->assertSession()->elementNotExists('xpath', "//div[contains(@class, 'top-bar__content')]/div[contains(@class, 'top-bar__actions')]/button");
92-
$this->assertSession()->elementExists('xpath', '//div[@id="block-tabs"]');
93-
94-
\Drupal::service('module_installer')->install(['navigation_top_bar']);
95-
96-
// Test page does not include the Top Bar.
97-
$test_page_url = Url::fromRoute('test_page_test.test_page');
98-
$this->verifyDynamicPageCache($test_page_url, 'MISS');
99-
$this->verifyDynamicPageCache($test_page_url, 'HIT');
100-
$this->assertSession()->elementNotExists('xpath', "//div[contains(@class, 'top-bar__content')]/div[contains(@class, 'top-bar__actions')]/button");
101-
102-
// Top Bar is visible once the feature flag module is enabled.
88+
// Top Bar is visible on node pages.
10389
$this->verifyDynamicPageCache($this->node->toUrl(), 'MISS');
10490
$this->verifyDynamicPageCache($this->node->toUrl(), 'HIT');
10591
$this->assertSession()->elementExists('xpath', "(//div[contains(@class, 'top-bar__content')]/div[contains(@class, 'top-bar__actions')]/button)[1]");

modules/navigation/tests/src/FunctionalJavascript/PerformanceTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@ public function testLogin(): void {
7373

7474
$expected = [
7575
'QueryCount' => 4,
76-
'CacheGetCount' => 58,
76+
'CacheGetCount' => 60,
7777
'CacheGetCountByBin' => [
7878
'config' => 11,
7979
'data' => 5,
8080
'discovery' => 10,
8181
'bootstrap' => 6,
8282
'dynamic_page_cache' => 2,
83-
'render' => 23,
83+
'render' => 25,
8484
'menu' => 1,
8585
],
8686
'CacheSetCount' => 2,

modules/navigation/tests/src/FunctionalJavascript/TopBarPerformanceTest.php

-81
This file was deleted.

phpunit.xml.dist

-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@
108108
<directory>modules/config/tests/config_test/tests/src/Functional</directory>
109109
<directory>modules/system/tests/modules/entity_test/tests/src/Functional</directory>
110110
<directory>modules/layout_builder/modules/layout_builder_expose_all_field_blocks/tests/src/Functional</directory>
111-
<directory>modules/navigation/modules/navigation_top_bar/tests/src/Functional</directory>
112111
<directory>profiles/**/tests/src/Functional</directory>
113112
<directory>profiles/demo_umami/modules/demo_umami_content/tests/src/Functional</directory>
114113
<directory>recipes/*/tests/src/Functional</directory>

0 commit comments

Comments
 (0)