X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Fmodules%2Fbook%2Fsrc%2FPlugin%2Fmigrate%2Fsource%2FBook.php;fp=web%2Fcore%2Fmodules%2Fbook%2Fsrc%2FPlugin%2Fmigrate%2Fsource%2FBook.php;h=08977fbc83e2d842a3d8d288317c37f43afef2f0;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hp=0000000000000000000000000000000000000000;hpb=74df008bdbb3a11eeea356744f39b802369bda3c;p=yaffs-website diff --git a/web/core/modules/book/src/Plugin/migrate/source/Book.php b/web/core/modules/book/src/Plugin/migrate/source/Book.php new file mode 100644 index 000000000..08977fbc8 --- /dev/null +++ b/web/core/modules/book/src/Plugin/migrate/source/Book.php @@ -0,0 +1,63 @@ +select('book', 'b')->fields('b', ['nid', 'bid']); + $query->join('menu_links', 'ml', 'b.mlid = ml.mlid'); + $ml_fields = ['mlid', 'plid', 'weight', 'has_children', 'depth']; + foreach (range(1, 9) as $i) { + $field = "p$i"; + $ml_fields[] = $field; + $query->orderBy('ml.' . $field); + } + return $query->fields('ml', $ml_fields); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['mlid']['type'] = 'integer'; + $ids['mlid']['alias'] = 'ml'; + return $ids; + } + + /** + * {@inheritdoc} + */ + public function fields() { + return [ + 'nid' => $this->t('Node ID'), + 'bid' => $this->t('Book ID'), + 'mlid' => $this->t('Menu link ID'), + 'plid' => $this->t('Parent link ID'), + 'weight' => $this->t('Weight'), + 'p1' => $this->t('The first mlid in the materialized path. If N = depth, then pN must equal the mlid. If depth > 1 then p(N-1) must equal the parent link mlid. All pX where X > depth must equal zero. The columns p1 .. p9 are also called the parents.'), + 'p2' => $this->t('The second mlid in the materialized path. See p1.'), + 'p3' => $this->t('The third mlid in the materialized path. See p1.'), + 'p4' => $this->t('The fourth mlid in the materialized path. See p1.'), + 'p5' => $this->t('The fifth mlid in the materialized path. See p1.'), + 'p6' => $this->t('The sixth mlid in the materialized path. See p1.'), + 'p7' => $this->t('The seventh mlid in the materialized path. See p1.'), + 'p8' => $this->t('The eighth mlid in the materialized path. See p1.'), + 'p9' => $this->t('The ninth mlid in the materialized path. See p1.'), + ]; + } + +}