function menu_edit_menu_name_exists

Returns whether a menu name already exists.

See also

menu_edit_menu()

form_validate_machine_name()

1 string reference to 'menu_edit_menu_name_exists'
menu_edit_menu in modules/menu/menu.admin.inc
Menu callback; Build the form that handles the adding/editing of a custom menu.

File

modules/menu/menu.admin.inc, line 588

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 = db_query_range('SELECT 1 FROM {menu_custom} WHERE menu_name = :menu', 0, 1, array(
        ':menu' => $value,
    ))->fetchField();
    $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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.