menuNameInUse example


  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()]));
      
// It's possible the definition has already been deleted, or doesn't exist.     if ($definition) {
      $instance = $this->createInstance($id);
      $this->deleteInstance($instance$persist);
    }
  }

  /** * {@inheritdoc} */
  public function menuNameInUse($menu_name) {
    $this->treeStorage->menuNameInUse($menu_name);
  }

  /** * {@inheritdoc} */
  public function countMenuLinks($menu_name = NULL) {
    return $this->treeStorage->countMenuLinks($menu_name);
  }

  /** * {@inheritdoc} */
Home | Imprint | This part of the site doesn't use cookies.