function MenuForm::menuNameExists
Same name in other branches
- 8.9.x core/modules/menu_ui/src/MenuForm.php \Drupal\menu_ui\MenuForm::menuNameExists()
- 10 core/modules/menu_ui/src/MenuForm.php \Drupal\menu_ui\MenuForm::menuNameExists()
- 11.x core/modules/menu_ui/src/MenuForm.php \Drupal\menu_ui\MenuForm::menuNameExists()
Returns whether a menu name already exists.
Parameters
string $value: The name of the menu.
Return value
bool Returns TRUE if the menu already exists, FALSE otherwise.
File
-
core/
modules/ menu_ui/ src/ MenuForm.php, line 165
Class
- MenuForm
- Base form for menu edit forms.
Namespace
Drupal\menu_uiCode
public function menuNameExists($value) {
// Check first to see if a menu with this ID exists.
if ($this->entityTypeManager
->getStorage('menu')
->getQuery()
->condition('id', $value)
->range(0, 1)
->count()
->execute()) {
return TRUE;
}
// Check for a link assigned to this menu.
return $this->menuLinkManager
->menuNameInUse($value);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.