diff --git a/config/install/navigation.settings.yml b/config/install/navigation.settings.yml index d62c8586738c7ee9a6a060a6a3ba9933bff87ae5..86e323407743436137afa6057fd899f5a06f4374 100644 --- a/config/install/navigation.settings.yml +++ b/config/install/navigation.settings.yml @@ -1 +1 @@ -hide_top_bar: true +show_top_bar: false diff --git a/config/schema/navigation.schema.yml b/config/schema/navigation.schema.yml index 01f29b8a063ec4a1152a0b0ffd8d98cdfea1048e..c3fab675a4fce80893d8d3ca5cf177e7f8e731f1 100644 --- a/config/schema/navigation.schema.yml +++ b/config/schema/navigation.schema.yml @@ -4,9 +4,9 @@ navigation.settings: type: config_object label: 'Navigation settings' mapping: - hide_top_bar: + show_top_bar: type: boolean - label: 'Hide top bar' + label: 'Show top bar' constraints: NotNull: [] diff --git a/src/Form/SettingsForm.php b/src/Form/SettingsForm.php index 4802ed6530f8641f4fd9513adea770ecca646879..9302baf2348f80a17425e11fc954bd0ad61eaf79 100644 --- a/src/Form/SettingsForm.php +++ b/src/Form/SettingsForm.php @@ -30,11 +30,11 @@ final class SettingsForm extends ConfigFormBase { * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state): array { - $form['hide_top_bar'] = [ + $form['show_top_bar'] = [ '#type' => 'checkbox', - '#title' => $this->t('Hide top bar'), - '#description' => $this->t('The top bar is initially shown at the top of the page, click the checkbox to hide it.'), - '#default_value' => $this->config('navigation.settings')->get('hide_top_bar'), + '#title' => $this->t('Show Top Bar (experimental)'), + '#description' => $this->t('The Top Bar is an experimental feature that moves common administrative information and tasks on edit forms to the top of the page. This is part of a larger push to simplify and modernize the editorial interface.'), + '#default_value' => $this->config('navigation.settings')->get('show_top_bar'), ]; return parent::buildForm($form, $form_state); } @@ -44,7 +44,7 @@ final class SettingsForm extends ConfigFormBase { */ public function submitForm(array &$form, FormStateInterface $form_state): void { $this->config('navigation.settings') - ->set('hide_top_bar', $form_state->getValue('hide_top_bar')) + ->set('show_top_bar', $form_state->getValue('show_top_bar')) ->save(); parent::submitForm($form, $form_state); } diff --git a/src/NavigationRenderer.php b/src/NavigationRenderer.php index dcd8acaa1e2e63fb3cd25e3008142cc144c111e6..651082676c95075adc070b396c6681868ecfe4bb 100644 --- a/src/NavigationRenderer.php +++ b/src/NavigationRenderer.php @@ -145,7 +145,7 @@ class NavigationRenderer { CacheableMetadata::createFromRenderArray($page_top['top_bar']) ->addCacheableDependency($navigation_settings) ->applyTo($page_top['top_bar']); - if ($navigation_settings->get('hide_top_bar') === TRUE) { + if ($navigation_settings->get('show_top_bar') === FALSE) { return; } @@ -186,7 +186,7 @@ class NavigationRenderer { CacheableMetadata::createFromRenderArray($build) ->addCacheableDependency($navigation_settings) ->applyTo($build); - if ($this->hasLocalTasks() && !$navigation_settings->get('hide_top_bar')) { + if ($this->hasLocalTasks() && $navigation_settings->get('show_top_bar')) { $build['#access'] = FALSE; } } diff --git a/tests/src/Functional/NavigationTopBarTest.php b/tests/src/Functional/NavigationTopBarTest.php index e02c74a497009c981637bdd0e1b5f597e9183666..a1b156e8041e12ff852365f8d599d260cbb3dcfd 100644 --- a/tests/src/Functional/NavigationTopBarTest.php +++ b/tests/src/Functional/NavigationTopBarTest.php @@ -84,7 +84,7 @@ class NavigationTopBarTest extends BrowserTestBase { $this->assertSession()->elementExists('xpath', '//div[@id="block-tabs"]'); $this->drupalGet('/admin/config/user-interface/navigation/settings'); - $this->submitForm(['hide_top_bar' => FALSE], 'Save configuration'); + $this->submitForm(['show_top_bar' => TRUE], 'Save configuration'); // Top Bar is visible once the hide option is disabled. $this->drupalGet($this->node->toUrl());