Skip to content

Commit ee8ab0b

Browse files
committed
Issue #2594425 follow-up by alexpott: Add the option in system menu block to "Expand all items in this tree"
1 parent f335587 commit ee8ab0b

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

core/modules/system/system.post_update.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,6 @@ function system_post_update_states_clear_cache() {
184184
*/
185185
function system_post_update_add_expand_all_items_key_in_system_menu_block(&$sandbox = NULL) {
186186
\Drupal::classResolver(ConfigEntityUpdater::class)->update($sandbox, 'block', function ($block) {
187-
if (strpos($block->getPluginId(), 'system_menu_block:') === 0) {
188-
$block->set('settings.expand_all_items', FALSE);
189-
return TRUE;
190-
}
191-
return FALSE;
187+
return strpos($block->getPluginId(), 'system_menu_block:') === 0;
192188
});
193189
}

core/modules/system/tests/src/Functional/Update/MenuBlockPostUpdateTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ protected function setDatabaseDumpFiles() {
3232
public function testPostUpdateMenuBlockFields() {
3333
$this->assertArrayNotHasKey('expand_all_items', Block::load('bartik_account_menu')->get('settings'));
3434
$this->runUpdates();
35-
$this->assertArrayHasKey('expand_all_items', Block::load('bartik_account_menu')->get('settings'));
35+
$settings = Block::load('bartik_account_menu')->get('settings');
36+
$this->assertArrayHasKey('expand_all_items', $settings);
37+
$this->assertFalse($settings['expand_all_items']);
3638
}
3739

3840
}

0 commit comments

Comments
 (0)