瀏覽代碼

terms

Signed-off-by: bachy <git@g-u-i.net>
bachy 12 年之前
父節點
當前提交
6c13226969
共有 1 個文件被更改,包括 22 次插入2 次删除
  1. 22 2
      migrate_materio.breves.inc

+ 22 - 2
migrate_materio.breves.inc

@@ -76,9 +76,11 @@ class MaterioBrevesNodeMigration extends MaterioBasicMigration {
 		$this->addFieldMapping('field_visuel:title', 'images_titles');
 		$this->addFieldMapping('field_visuel:alt', 'images_alts');
 
-		// $this->addFieldMapping('field_source', 'source');
 		$this->addFieldMapping('field_video_filter', 'video');
 
+		$this->addFieldMapping('field_tags_libres', 'tags');
+		$this->addFieldMapping('field_tags_libres:create_term')->defaultValue(TRUE);
+
 		$this->addUnmigratedDestinations(array('revision', 'revision_uid', 'log', 'tnid', 'comment', 'uid', 'path', 'pathauto',
 			'title_field:format',
 			'body:summary',
@@ -88,6 +90,7 @@ class MaterioBrevesNodeMigration extends MaterioBasicMigration {
 			'field_memo:format', 'field_memo:language',
 			'field_onthologie', 'field_onthologie:source_type', 'field_onthologie:create_term',
 			'field_visuel:file_class','field_visuel:language','field_visuel:destination_dir','field_visuel:destination_file','field_visuel:file_replace','field_visuel:preserve_files',
+			'field_tags_libres', 'field_tags_libres:source_type', 'field_tags_libres:create_term',
 		));
 
 	}
@@ -97,7 +100,7 @@ class MaterioBrevesNodeMigration extends MaterioBasicMigration {
 		print "\n- - - - - - - - \n";
 		// print $cr->nid . "\n";
 		print $cr->title . "\n";		
-		
+
 		$body = $cr->body;
 		
 		$cr->memo = '';
@@ -183,6 +186,23 @@ class MaterioBrevesNodeMigration extends MaterioBasicMigration {
 			$cr->video = $matches[1];
 		}
 
+
+		$query = db_select(MIG_MAT_SRC_DB_D6 .'.fr_term_node', 'tn');
+		$query->join(MIG_MAT_SRC_DB_D6 .'.fr_term_data', 'td', 'td.tid = tn.tid');
+
+		$query
+			->condition('tn.nid', $cr->nid, "=")
+			->fields('td', array('name'));
+
+		$result = $query->execute();
+		$terms = array();
+		foreach ($result as $record) {
+			$terms[] = $record->name;
+		}
+		$cr->memo .= 'terms : '.implode(', ', $terms)."\n";
+
+
+
 		return TRUE;
 	}