/** * Returns whether a menu name already exists. * * @param string $value * The name of the menu. * * @return bool * Returns TRUE if the menu already exists, FALSE otherwise. */ public function menuNameExists($value) { // Check first to see if a menu with this ID exists. if ($this->entityQueryFactory->get('menu')->condition('id', $value)->range(0, 1)->count()->execute()) { return TRUE; } // Check for a link assigned to this menu. return $this->menuLinkManager->menuNameInUse($value); }