Skip to content
Snippets Groups Projects
Commit 682ed157 authored by Konstantin Shupenko's avatar Konstantin Shupenko
Browse files

Merge branch '3436935-change-the-wording' into '1.x'

Change the wording for the Top Bar checkbox

See merge request !213
parents ce4adf83 8c10c0de
No related branches found
No related tags found
No related merge requests found
Pipeline #134133 passed with warnings
hide_top_bar: true
show_top_bar: false
......@@ -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: []
......
......@@ -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);
}
......
......@@ -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;
}
}
......
......@@ -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());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment