1 menu.admin.inc menu_edit_menu_name_exists($value)

Returns whether a menu name already exists.

See also

menu_edit_menu()

form_validate_machine_name()

File

core/modules/menu/menu.admin.inc, line 698
Admin page callbacks for the Menu module.

Code

function menu_edit_menu_name_exists($value) {
  // 'menu-' is added to the menu name to avoid name-space conflicts.
  $value = 'menu-' . $value;
  $custom_exists = (bool) menu_load($value);
  $link_exists = db_query_range("SELECT 1 FROM {menu_links} WHERE menu_name = :menu", 0, 1, array(':menu' => $value))->fetchField();

  return $custom_exists || $link_exists;
}