I don't see why block module should be responsible for deleting the blocks created by menu module with function block_menu_delete. All of the other code having to do with menu module making blocks is in menu module.

This change was made in #473082: Add custom menu API but without any comment about the rationale there.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bleen’s picture

Priority: Normal » Minor
Status: Active » Needs review
FileSize
1.37 KB

Not sure if this should be in menu_delete() but for some reason I feel like having an implementation of hook_menu_delete seems more correct. Seems to separate the code better.

benjy’s picture

Status: Needs review » Needs work

This no longer applies.

It also needs changing as I don't think we use "delta" anymore. See the new implementation in the block.module

zhuber’s picture

Status: Needs work » Needs review
FileSize
1.15 KB

I've re-done this patch to work with the most recent changes in Drupal 8 core.

Please have a look and review when you can.

benjy’s picture

Status: Needs review » Reviewed & tested by the community

Great, thanks.

tim.plunkett’s picture

Title: Remove block_menu_delete » Move block_menu_delete() into menu_menu_delete()
Priority: Minor » Normal
Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/menu/menu.module
@@ -226,6 +226,11 @@ function menu_menu_delete(Menu $menu) {
+    foreach (entity_load_multiple('block') as $block) {
+      if ($block->get('plugin') == 'system_menu_block:' . $menu->id()) {

This could actually be foreach (entity_load_multiple_by_properties('block', array('plugin' => 'system_menu_block:' . $menu->id())) as $block) {

benjy’s picture

Status: Needs work » Needs review
FileSize
743 bytes
1.13 KB

Good call. New patch attached.

Berdir’s picture

Hm. the menu blocks are provided by system.module, so it's not really clear to me what belongs in which module.

tim.plunkett’s picture

Ugh, yes, I always forget this. Which is part of why #2085243: Rename Menu module into Menu UI module needs to happen.

benjy’s picture

Added Tim's feedback from #5

tim.plunkett’s picture

Title: Move block_menu_delete() into menu_menu_delete() » Move block code from menu_menu_delete() into block_menu_delete()

Thanks!

tim.plunkett’s picture

Title: Move block code from menu_menu_delete() into block_menu_delete() » Move block code from menu_ui_menu_delete() into block_menu_delete()
Issue summary: View changes
FileSize
1.68 KB

Reroll

dawehner’s picture

dawehner’s picture

Status: Needs review » Closed (duplicate)

.