444c38feb921c1e79c39b2822620a993c349c282
[yaffs-website] / web / core / modules / shortcut / src / Plugin / migrate / source / d7 / Shortcut.php
1 <?php
2
3 namespace Drupal\shortcut\Plugin\migrate\source\d7;
4
5 use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
6
7 /**
8  * Drupal 7 shortcut links source from database.
9  *
10  * @MigrateSource(
11  *   id = "d7_shortcut",
12  *   source_provider = "shortcut"
13  * )
14  */
15 class Shortcut extends DrupalSqlBase {
16
17   /**
18    * {@inheritdoc}
19    */
20   public function query() {
21     return $this->select('menu_links', 'ml')
22       ->fields('ml', ['mlid', 'menu_name', 'link_path', 'link_title', 'weight'])
23       ->condition('hidden', '0')
24       ->condition('menu_name', 'shortcut-set-%', 'LIKE')
25       ->orderBy('ml.mlid');
26   }
27
28   /**
29    * {@inheritdoc}
30    */
31   public function fields() {
32     return [
33       'mlid' => $this->t("The menu.mlid primary key for this menu item (= shortcut link)."),
34       'menu_name' => $this->t("The menu_name (= set name) for this shortcut link."),
35       'link_path' => $this->t("The link for this shortcut."),
36       'link_title' => $this->t("The title for this shortcut."),
37       'weight' => $this->t("The weight for this shortcut"),
38     ];
39   }
40
41   /**
42    * {@inheritdoc}
43    */
44   public function getIds() {
45     $ids['mlid']['type'] = 'integer';
46     return $ids;
47   }
48
49 }