You are here

public function MongodbMenuTreeStorage::countMenuLinks in MongoDB 8

Counts the total number of menu links in one menu or all menus.

Parameters

string $menu_name: (optional) The menu name to count by. Defaults to all menus.

Return value

int The number of menu links in the named menu, or in all menus if the menu name is NULL.

Overrides MenuTreeStorage::countMenuLinks

File

src/MongodbMenuTreeStorage.php, line 395
Contains \Drupal\mongodb\MongodbMenuTreeStorage .

Class

MongodbMenuTreeStorage

Namespace

Drupal\mongodb

Code

public function countMenuLinks($menu_name = NULL) {
  $query = [];
  if ($menu_name) {
    $query['menu_name'] = $menu_name;
  }
  return $this
    ->mongoCollection()
    ->count($query);
}