You are here

public function MenuTreeStorage::getExpanded in Colossal Menu 8

Same name and namespace in other branches
  1. 2.x src/Menu/MenuTreeStorage.php \Drupal\colossal_menu\Menu\MenuTreeStorage::getExpanded()

Finds expanded links in a menu given a set of possible parents.

Parameters

string $menu_name: The menu name.

array $parents: One or more parent IDs to match.

Return value

array The menu link IDs that are flagged as expanded in this menu.

Overrides MenuTreeStorageInterface::getExpanded

File

src/Menu/MenuTreeStorage.php, line 324

Class

MenuTreeStorage
Provides a menu tree storage using the database.

Namespace

Drupal\colossal_menu\Menu

Code

public function getExpanded($menu_name, array $parents) {
  $query = $this->connection
    ->select($this->table, 't')
    ->fields('t', [
    'descendant',
  ])
    ->condition('t.ancestor', $parents)
    ->condition('e.menu', $menu_name)
    ->orderBy('t.depth', 'ASC')
    ->orderBy('e.weight', 'ASC');
  $query
    ->innerJoin($this->storage
    ->getEntityType()
    ->get('base_table'), 'e', 't.ancestor = e.id');
  return $query
    ->execute()
    ->fetchCol();
}