function MenuLinkTranslation::query

Same name in this branch
  1. 10 core/modules/menu_link_content/src/Plugin/migrate/source/d6/MenuLinkTranslation.php \Drupal\menu_link_content\Plugin\migrate\source\d6\MenuLinkTranslation::query()
Same name in other branches
  1. 9 core/modules/menu_link_content/src/Plugin/migrate/source/d6/MenuLinkTranslation.php \Drupal\menu_link_content\Plugin\migrate\source\d6\MenuLinkTranslation::query()
  2. 9 core/modules/menu_link_content/src/Plugin/migrate/source/d7/MenuLinkTranslation.php \Drupal\menu_link_content\Plugin\migrate\source\d7\MenuLinkTranslation::query()
  3. 8.9.x core/modules/menu_link_content/src/Plugin/migrate/source/d6/MenuLinkTranslation.php \Drupal\menu_link_content\Plugin\migrate\source\d6\MenuLinkTranslation::query()
  4. 11.x core/modules/menu_link_content/src/Plugin/migrate/source/d6/MenuLinkTranslation.php \Drupal\menu_link_content\Plugin\migrate\source\d6\MenuLinkTranslation::query()
  5. 11.x core/modules/menu_link_content/src/Plugin/migrate/source/d7/MenuLinkTranslation.php \Drupal\menu_link_content\Plugin\migrate\source\d7\MenuLinkTranslation::query()

Overrides MenuLink::query

File

core/modules/menu_link_content/src/Plugin/migrate/source/d7/MenuLinkTranslation.php, line 26

Class

MenuLinkTranslation
Drupal 7 i18n menu link translations source from database.

Namespace

Drupal\menu_link_content\Plugin\migrate\source\d7

Code

public function query() {
    $query = parent::query();
    // Add in the property, which is either title or description. Cast the mlid
    // to text so PostgreSQL can make the join.
    $query->leftJoin('i18n_string', 'i18n', 'CAST([ml].[mlid] AS CHAR(255)) = [i18n].[objectid]');
    $query->fields('i18n', [
        'lid',
        'objectid',
        'property',
        'textgroup',
    ])
        ->condition('i18n.textgroup', 'menu')
        ->condition('i18n.type', 'item');
    // Add in the translation for the property.
    $query->innerJoin('locales_target', 'lt', '[i18n].[lid] = [lt].[lid]');
    $query->addField('lt', 'language', 'lt_language');
    $query->fields('lt', [
        'translation',
    ]);
    $query->isNotNull('lt.language');
    return $query;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.