You are here

public function i18n_menu_link_translation_set::load_translations in Internationalization 7

Load all path translations

Overrides i18n_translation_set::load_translations

File

i18n_menu/i18n_menu.inc, line 10
Internationalization (i18n) module - Translation set

Class

i18n_menu_link_translation_set
@file Internationalization (i18n) module - Translation set

Code

public function load_translations() {
  $translations = array();
  $query = db_select('menu_links', 'ml');
  $query
    ->leftJoin('menu_router', 'm', 'm.path = ml.router_path');
  $query
    ->fields('ml');

  // Weight should be taken from {menu_links}, not {menu_router}.
  $query
    ->addField('ml', 'weight', 'link_weight');
  $query
    ->fields('m');
  $query
    ->condition('ml.i18n_tsid', $this->tsid);
  foreach ($query
    ->execute()
    ->fetchAll(PDO::FETCH_ASSOC) as $item) {
    $item['weight'] = $item['link_weight'];
    _menu_link_translate($item);
    $translations[$item['language']] = $item;
  }
  return $translations;
}