Files
2020-09-23 15:50:29 +02:00

52 lines
1.4 KiB
PHP

<?php
/**
* PerfGroupeNodeMigration
*
*/
class PerfDvidsNodeMigration extends PerfDNodeMigration {
public function __construct() {
$this->description = t('Migrate Document Video Class');
$this->fields = array(
'fichiers' => t('fichiers'),
'etat_conservation' => t('etat_conservation'),
);
// This can also be an URL instead of a file path.
$xml_folder = DRUPAL_ROOT . '/' . drupal_get_path('module', 'PerfMigrate') . '/xml/';
$this->items_url = $xml_folder . 'baseperf-dvids.xml';
$this->item_xpath = '/ROOT/ITEMS/DOC_AUDIOVISUEL'; // relative to document
$this->destination = new MigrateDestinationNode('document_video');
parent::__construct();
$this->addFieldMapping('field_etat_de_conservation', 'etat_conservation')
->xpath('@ETAT_CONSERVATION');
$this->addFieldMapping('field_fichiers', 'fichiers');
$this->addUnmigratedDestinations(array(
'field_etat_de_conservation:language', 'field_etat_de_conservation:format',
'field_fichiers:language', 'field_fichiers:format',
));
}
public function prepareRow($row){
parent::prepareRow($row);
$xml = $row->xml;
$row->fichiers .= "\n".'Fichier MP4 : '.$this->getAttribute($xml, 'FICHIER_MP4');
$row->fichiers .= "\n".'Fichier FLV : '.$this->getAttribute($xml, 'FICHIER_FLV');
}
public function prepare($node, stdClass $row) {
parent::prepare($node, $row);
}
}