You are here

protected function EntityMenuLinkCloneForm::getMenuItemIds in Menu Link Clone 8

Get menu items ids.

Parameters

string $menu_id: Menu name for which we need to check their items ids.

2 calls to EntityMenuLinkCloneForm::getMenuItemIds()
EntityMenuLinkCloneForm::cloneMenuLinks in src/Form/EntityMenuLinkCloneForm.php
Clone menu items.
EntityMenuLinkCloneForm::menuLinksAvailabilityCheck in src/Form/EntityMenuLinkCloneForm.php
Check Menu Link items are availabe inside the menu.

File

src/Form/EntityMenuLinkCloneForm.php, line 101

Class

EntityMenuLinkCloneForm
Provides a menu link clone form.

Namespace

Drupal\menu_link_clone\Form

Code

protected function getMenuItemIds($menu_id) {
  $result = [];
  $menuLinkIds = \Drupal::entityQuery('menu_link_content')
    ->condition('menu_name', $menu_id)
    ->execute();
  if (isset($menuLinkIds) && !empty($menuLinkIds)) {
    $result['status'] = TRUE;
    $result['items'] = $menuLinkIds;
  }
  else {
    $result['status'] = FALSE;
    $result['items'] = [];
  }
  return $result;
}