Hello,

I have read the documentation on how to add a menu item. I have made a custom module. Usually I use hooks to alter antything in the site. Am I supposed to be calling this menu creation code as part of a hook?

use Drupal\menu_link_content\Entity\MenuLinkContent;

  $menu_link = MenuLinkContent::create([
    'title' => t('Mein Konto'),
    'link' => ['uri' => 'internal:/user/' . $uid . '/edit'],
    'menu_name' => 'account',
    'expanded' => TRUE,
]);
  $menu_link->save();
}

Cheers,
Urs