You are here

public function MenuLink::query in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/menu_link_content/src/Plugin/migrate/source/MenuLink.php \Drupal\menu_link_content\Plugin\migrate\source\MenuLink::query()
  2. 9 core/modules/menu_link_content/src/Plugin/migrate/source/MenuLink.php \Drupal\menu_link_content\Plugin\migrate\source\MenuLink::query()

Return value

\Drupal\Core\Database\Query\SelectInterface

Overrides SqlBase::query

3 methods override MenuLink::query()
MenuLinkLocalized::query in core/modules/menu_link_content/src/Plugin/migrate/source/d7/MenuLinkLocalized.php
MenuLinkTranslation::query in core/modules/menu_link_content/src/Plugin/migrate/source/d6/MenuLinkTranslation.php
MenuLinkTranslation::query in core/modules/menu_link_content/src/Plugin/migrate/source/d7/MenuLinkTranslation.php

File

core/modules/menu_link_content/src/Plugin/migrate/source/MenuLink.php, line 51

Class

MenuLink
Drupal 6/7 menu link source from database.

Namespace

Drupal\menu_link_content\Plugin\migrate\source

Code

public function query() {
  $query = $this
    ->select('menu_links', 'ml')
    ->fields('ml');
  $and = $query
    ->andConditionGroup()
    ->condition('ml.module', 'menu')
    ->condition('ml.router_path', [
    'admin/build/menu-customize/%',
    'admin/structure/menu/manage/%',
  ], 'NOT IN');
  $condition = $query
    ->orConditionGroup()
    ->condition('ml.customized', 1)
    ->condition($and);
  $query
    ->condition($condition);
  if (isset($this->configuration['menu_name'])) {
    $query
      ->condition('ml.menu_name', (array) $this->configuration['menu_name'], 'IN');
  }
  $query
    ->leftJoin('menu_links', 'pl', '[ml].[plid] = [pl].[mlid]');
  $query
    ->addField('pl', 'link_path', 'parent_link_path');
  $query
    ->orderBy('ml.depth');
  $query
    ->orderby('ml.mlid');
  return $query;
}