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);
} /**
* {@inheritdoc}
*/
public function save(array
$form, FormStateInterface
$form_state) { $menu =
$this->entity;
$status =
$menu->
save();
$edit_link =
$this->entity->
toLink($this->
t('Edit'
), 'edit-form'
)->
toString();
if ($status == SAVED_UPDATED
) { $this->
messenger()->
addStatus($this->
t('Menu %label has been updated.',
['%label' =>
$menu->
label()]));