I have a script where I instantiate and fill menus with menu items programmatically.

Whats the best way to check if a menu already exists if I already know it's ID.


A menu is a config entity, which means you can use standard entity API to load it.

\Drupal\system\Entity\Menu::load() or \Drupal:entityTypeManager()->getStorage('menu')->load()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.