You are here

public function MenutrailbypathMenuHelper::getMenuLinksByPaths in Menu Trail By Path 7.3

Find link items matching the given link_paths in (almost) all menus

Parameters

$link_paths:

Return value

array

File

src/MenutrailbypathMenuHelper.inc, line 25

Class

MenutrailbypathMenuHelper

Code

public function getMenuLinksByPaths(array $link_paths) {
  if (empty($link_paths)) {
    return array();
  }
  $query = db_select('menu_links', 'ml')
    ->fields('ml')
    ->condition('link_path', $link_paths, 'IN')
    ->condition('hidden', 0)
    ->orderBy('depth')
    ->orderBy('weight')
    ->orderBy('mlid');
  if (module_exists('i18n_menu')) {
    $query
      ->condition('language', array(
      LANGUAGE_NONE,
      $this->language->language,
    ), 'IN');
  }
  $results = $query
    ->execute();
  return $results instanceof DatabaseStatementInterface ? $this
    ->translateMenuLinkTitles($results
    ->fetchAll()) : array();
}