Score:0

Altering menu machine-name

pt flag

A website I'm inherited somehow has a menu which has an underscore in it's machine name. In my attempt to alter that machine name, I found this post and created the following update function:

function mymodule_update_8019()
{
  Drupal::messenger()->addMessage('updating ...');
  $database = Drupal::database();

  $database->update('menu_tree')
    ->fields([
      'menu_name' => 'hierarchy-menu'
    ])
    ->condition('menu_name', 'hierarchy_menu', '=')
    ->execute();
}

But all hierarchy_menu entries in the menu_name column of the menu_tree table remains unchanged instead of being updated to hierarchy-menu.

I would appreciate pointer on what I am missing/overlooking, please.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.