created plugins for migration

thesaurus is importing well for default language (en)
This commit is contained in:
Bachir Soussi Chiadmi 2018-11-28 11:54:22 +01:00
parent 374c688f36
commit 878d6f510c
15 changed files with 527 additions and 194 deletions

View File

@ -1,35 +0,0 @@
id: d7_taxonomy_vocabulary_company
label: Taxonomy vocabularies Company
migration_group: d7_materio
migration_tags:
- Drupal 7
- Configuration
- Materio
source:
plugin: d7_taxonomy_vocabulary
bundle: company
destination:
plugin: entity:taxonomy_vocabulary
process:
vid:
-
plugin: make_unique_entity_field
source: machine_name
entity_type: taxonomy_vocabulary
field: vid
length: 32
migrated: true
-
# This plugin checks if the vocabulary being migrated is the one used by
# Forum. If so, we use the machine name that Forum expects. Otherwise, we
# leave it unchanged.
plugin: forum_vocabulary
machine_name: forums
label: name
name: name
description: description
hierarchy: hierarchy
weight: weight

View File

@ -1,35 +0,0 @@
id: d7_taxonomy_vocabulary_showroom
label: Taxonomy vocabularies Showroom
migration_group: d7_materio
migration_tags:
- Drupal 7
- Configuration
- Materio
source:
plugin: d7_taxonomy_vocabulary
bundle: showroom
destination:
plugin: entity:taxonomy_vocabulary
process:
vid:
-
plugin: make_unique_entity_field
source: machine_name
entity_type: taxonomy_vocabulary
field: vid
length: 32
migrated: true
-
# This plugin checks if the vocabulary being migrated is the one used by
# Forum. If so, we use the machine name that Forum expects. Otherwise, we
# leave it unchanged.
plugin: forum_vocabulary
machine_name: forums
label: name
name: name
description: description
hierarchy: hierarchy
weight: weight

View File

@ -1,35 +0,0 @@
id: d7_taxonomy_vocabulary_tags
label: Taxonomy vocabularies Tags
migration_group: d7_materio
migration_tags:
- Drupal 7
- Configuration
- Materio
source:
plugin: d7_taxonomy_vocabulary
bundle: tag_libres
destination:
plugin: entity:taxonomy_vocabulary
process:
vid:
-
plugin: make_unique_entity_field
source: machine_name
entity_type: taxonomy_vocabulary
field: vid
length: 32
migrated: true
-
# This plugin checks if the vocabulary being migrated is the one used by
# Forum. If so, we use the machine name that Forum expects. Otherwise, we
# leave it unchanged.
plugin: forum_vocabulary
machine_name: forums
label: name
name: name
description: description
hierarchy: hierarchy
weight: weight

View File

@ -1,35 +0,0 @@
id: d7_taxonomy_vocabulary_thesaurus
label: Taxonomy vocabularies Thesaurus
migration_group: d7_materio
migration_tags:
- Drupal 7
- Configuration
- Materio
source:
plugin: d7_taxonomy_vocabulary
bundle: onthologie
destination:
plugin: entity:taxonomy_vocabulary
process:
vid:
-
plugin: make_unique_entity_field
source: machine_name
entity_type: taxonomy_vocabulary
field: vid
length: 32
migrated: true
-
# This plugin checks if the vocabulary being migrated is the one used by
# Forum. If so, we use the machine name that Forum expects. Otherwise, we
# leave it unchanged.
plugin: forum_vocabulary
machine_name: forums
label: name
name: name
description: description
hierarchy: hierarchy
weight: weight

View File

@ -38,3 +38,22 @@ process:
revision_log: log revision_log: log
revision_timestamp: timestamp revision_timestamp: timestamp
content_translation_source: source content_translation_source: source
# TODO: mémo (field_memo)
# TODO: nature (field_nature_titre)
# TODO: description (field_description)
# TODO: thesaurus (field_onthologie)
# TODO: tags (field_tags_libres)
# TODO: images (field_materiau_image)
# TODO: videos (field_video_filter)
# TODO: manufacturer (field_company_fab)
# TODO: distributor (field_company_distrib)
# TODO: fichiers (field_attachments)
# TODO: materiaux liés (field_materiau_ref)
# TODO: breves liées (field_breve_ref)
# TODO: samples (field_location)
# TODO: famille (field_famille)
# TODO: identifiant (field_identifiant)
# TODO: reference materio (field_reference_materio) COMPUTED
# TODO: workflow
# TODO: translations

View File

@ -9,27 +9,19 @@ migration_tags:
deriver: Drupal\taxonomy\Plugin\migrate\D7TaxonomyTermDeriver deriver: Drupal\taxonomy\Plugin\migrate\D7TaxonomyTermDeriver
source: source:
plugin: d7_taxonomy_term plugin: d7_taxonomy_term_company
bundle: company bundle: company
destination: destination:
plugin: entity:taxonomy_term plugin: entity:taxonomy_term
bundle: company
# migration_dependencies:
# required:
# - d7_taxonomy_vocabulary_company
# optional:
# - d7_field_instance
process: process:
# If you are using this file to build a custom migration consider removing # If you are using this file to build a custom migration consider removing
# the tid field to allow incremental migrations. # the tid field to allow incremental migrations.
tid: tid # tid: tid
vid: vid:
plugin: migration_lookup plugin: default_value
migration: d7_taxonomy_vocabulary_company default_value: company
source: vid
name: name name: name
'description/value': description 'description/value': description
'description/format': format 'description/format': format
@ -49,3 +41,5 @@ process:
source: '@parent_id' source: '@parent_id'
forum_container: is_container forum_container: is_container
changed: timestamp changed: timestamp
# TODO: tode node company

View File

@ -9,27 +9,19 @@ migration_tags:
deriver: Drupal\taxonomy\Plugin\migrate\D7TaxonomyTermDeriver deriver: Drupal\taxonomy\Plugin\migrate\D7TaxonomyTermDeriver
source: source:
plugin: d7_taxonomy_term plugin: d7_taxonomy_term_showroom
bundle: showroom bundle: showroom
destination: destination:
plugin: entity:taxonomy_term plugin: entity:taxonomy_term
bundle: showroom
# migration_dependencies:
# required:
# - d7_taxonomy_vocabulary_showroom
# optional:
# - d7_field_instance
process: process:
# If you are using this file to build a custom migration consider removing # If you are using this file to build a custom migration consider removing
# the tid field to allow incremental migrations. # the tid field to allow incremental migrations.
tid: tid # tid: tid
vid: vid:
plugin: migration_lookup plugin: default_value
migration: d7_taxonomy_vocabulary_showroom default_value: showroom
source: vid
name: name name: name
'description/value': description 'description/value': description
'description/format': format 'description/format': format
@ -49,3 +41,5 @@ process:
source: '@parent_id' source: '@parent_id'
forum_container: is_container forum_container: is_container
changed: timestamp changed: timestamp
# TODO: tode node showroom

View File

@ -9,27 +9,19 @@ migration_tags:
deriver: Drupal\taxonomy\Plugin\migrate\D7TaxonomyTermDeriver deriver: Drupal\taxonomy\Plugin\migrate\D7TaxonomyTermDeriver
source: source:
plugin: d7_taxonomy_term plugin: d7_taxonomy_term_tags
bundle: tag_libres bundle: tag_libres
destination: destination:
plugin: entity:taxonomy_term plugin: entity:taxonomy_term
bundle: tags
# migration_dependencies:
# required:
# - d7_taxonomy_vocabulary_tags
# optional:
# - d7_field_instance
process: process:
# If you are using this file to build a custom migration consider removing # If you are using this file to build a custom migration consider removing
# the tid field to allow incremental migrations. # the tid field to allow incremental migrations.
# tid: tid # tid: tid
vid: vid:
plugin: migration_lookup plugin: default_value
migration: d7_taxonomy_vocabulary_tags default_value: tags
source: vid
name: name name: name
'description/value': description 'description/value': description
'description/format': format 'description/format': format
@ -49,3 +41,8 @@ process:
source: '@parent_id' source: '@parent_id'
forum_container: is_container forum_container: is_container
changed: timestamp changed: timestamp
#synonyms
field_synonyms: synonyms
# TODO translation

View File

@ -9,27 +9,19 @@ migration_tags:
deriver: Drupal\taxonomy\Plugin\migrate\D7TaxonomyTermDeriver deriver: Drupal\taxonomy\Plugin\migrate\D7TaxonomyTermDeriver
source: source:
plugin: d7_taxonomy_term plugin: d7_taxonomy_term_thesaurus
bundle: onthologie bundle: onthologie
destination: destination:
plugin: entity:taxonomy_term plugin: entity:taxonomy_term
bundle: thesaurus
# migration_dependencies:
# required:
# - d7_taxonomy_vocabulary_thesaurus
# optional:
# - d7_field_instance
process: process:
# If you are using this file to build a custom migration consider removing # If you are using this file to build a custom migration consider removing
# the tid field to allow incremental migrations. # the tid field to allow incremental migrations.
tid: tid # tid: tid
vid: vid:
plugin: migration_lookup plugin: default_value
migration: d7_taxonomy_vocabulary_thesaurus default_value: thesaurus
source: vid
name: name name: name
'description/value': description 'description/value': description
'description/format': format 'description/format': format
@ -49,3 +41,11 @@ process:
source: '@parent_id' source: '@parent_id'
forum_container: is_container forum_container: is_container
changed: timestamp changed: timestamp
#synonyms
field_synonyms: synonyms
# used on advanced search
field_used_on_advanced_search: advanced_search
# TODO translation

View File

@ -4,23 +4,19 @@ description: Defines custom migration for materio (from d7 to d8).
core: 8.x core: 8.x
package: Materio package: Materio
dependencies: dependencies:
- config_devel
- drupal:migrate - drupal:migrate
- drupal:migrate_drupal - drupal:migrate_drupal
- drupal:migrate_drupal_multilingual - drupal:migrate_drupal_multilingual
# - drupal:field_group_migrate
- migrate_plus:migrate_plus - migrate_plus:migrate_plus
- migrate_tools:migrate_tools - migrate_tools:migrate_tools
- config_devel # - drupal:field_group_migrate
config_devel: config_devel:
install: install:
- migrate_plus.migration_group.d7_materio - migrate_plus.migration_group.d7_materio
# - migrate_plus.migration.d7_taxonomy_vocabulary_tags
- migrate_plus.migration.d7_taxonomy_term_tags
# - migrate_plus.migration.d7_taxonomy_vocabulary_thesaurus
- migrate_plus.migration.d7_taxonomy_term_thesaurus - migrate_plus.migration.d7_taxonomy_term_thesaurus
# - migrate_plus.migration.d7_taxonomy_vocabulary_showroom - migrate_plus.migration.d7_taxonomy_term_tags
- migrate_plus.migration.d7_taxonomy_term_showroom - migrate_plus.migration.d7_taxonomy_term_showroom
# - migrate_plus.migration.d7_taxonomy_vocabulary_company
- migrate_plus.migration.d7_taxonomy_term_company - migrate_plus.migration.d7_taxonomy_term_company
- migrate_plus.migration.d7_node_entity_translation_materiau - migrate_plus.migration.d7_node_entity_translation_materiau

View File

@ -1,3 +1,5 @@
[debugging-migrations](https://www.drupal.org/docs/8/api/migrate-api/debugging-migrations)
https://www.drupaleasy.com/blogs/ultimike/2016/04/drupal-6-drupal-81x-custom-content-migration https://www.drupaleasy.com/blogs/ultimike/2016/04/drupal-6-drupal-81x-custom-content-migration
https://thinkshout.com/blog/2017/05/skipping-a-version-migrating-from-drupal-6-to-drupal-8-with-drupal-migrate/ https://thinkshout.com/blog/2017/05/skipping-a-version-migrating-from-drupal-6-to-drupal-8-with-drupal-migrate/
@ -27,3 +29,7 @@ https://evolvingweb.ca/blog/drupal-8-migration-migrating-taxonomy-term-reference
[Migrating Drupal 7 redirects to Drupal 8](http://activelamp.com/blog/drupal/migrating-drupal-8-redirects/) [Migrating Drupal 7 redirects to Drupal 8](http://activelamp.com/blog/drupal/migrating-drupal-8-redirects/)
[How to refresh new migrations in Drupal 8 migration module?](https://drupal.stackexchange.com/questions/191435/how-to-refresh-new-migrations-in-drupal-8-migration-module) [How to refresh new migrations in Drupal 8 migration module?](https://drupal.stackexchange.com/questions/191435/how-to-refresh-new-migrations-in-drupal-8-migration-module)
[Drupal 8 Migrations: Taxonomy and Nodes](https://www.phase2technology.com/blog/drupal-8-migrations)
[Migrating Content Translated with "Content Translation" from Drupal 7 to Drupal 8](https://evolvingweb.ca/blog/migrating-content-translated-content-translation-drupal-7-drupal-8)

View File

@ -0,0 +1,104 @@
<?php
namespace Drupal\materio_migrate\Plugin\migrate\source;
use Drupal\migrate\Row;
use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
/**
* Taxonomy term source from database.
*
* @MigrateSource(
* id = "d7_taxonomy_term_company",
* source_module = "taxonomy"
* )
*/
class D7TaxonomyTermCompany extends FieldableEntity {
/**
* {@inheritdoc}
*/
public function query() {
$query = $this->select('taxonomy_term_data', 'td')
->fields('td')
->distinct()
->orderBy('tid');
$query->leftJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid');
$query->addField('tv', 'machine_name');
if (isset($this->configuration['bundle'])) {
$query->condition('tv.machine_name', (array) $this->configuration['bundle'], 'IN');
}
return $query;
}
/**
* {@inheritdoc}
*/
public function fields() {
$fields = [
'tid' => $this->t('The term ID.'),
'vid' => $this->t('Existing term VID'),
'machine_name' => $this->t('Vocabulary machine name'),
'name' => $this->t('The name of the term.'),
'description' => $this->t('The term description.'),
'weight' => $this->t('Weight'),
'parent' => $this->t("The Drupal term IDs of the term's parents."),
'format' => $this->t("Format of the term description."),
];
return $fields;
}
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row) {
print("\n".'-- prepareRow -- '.$row->getSourceProperty('tid')." -- ".$row->getSourceProperty('name')."\n");
// Get Field API field values.
foreach (array_keys($this->getFields('taxonomy_term', $row->getSourceProperty('machine_name'))) as $field) {
$tid = $row->getSourceProperty('tid');
$row->setSourceProperty($field, $this->getFieldValues('taxonomy_term', $field, $tid));
}
// Find parents for this row.
$parents = $this->select('taxonomy_term_hierarchy', 'th')
->fields('th', ['parent', 'tid'])
->condition('tid', $row->getSourceProperty('tid'))
->execute()
->fetchCol();
$row->setSourceProperty('parent', $parents);
// print_r($parents);
// If the term name or term description were replaced by real fields using
// the Drupal 7 Title module, use the fields value instead of the term name
// or term description.
// TODO: translations
if ($this->moduleExists('title')) {
$name_field = $row->getSourceProperty('name_field');
// print_r($name_field);
if (isset($name_field[0]['value'])) {
$row->setSourceProperty('name', $name_field[0]['value']);
}
$description_field = $row->getSourceProperty('description_field');
if (isset($description_field[0]['value'])) {
$row->setSourceProperty('description', $description_field[0]['value']);
}
}
// TODO: tode node company
return parent::prepareRow($row);
}
/**
* {@inheritdoc}
*/
public function getIds() {
$ids['tid']['type'] = 'integer';
return $ids;
}
}

View File

@ -0,0 +1,102 @@
<?php
namespace Drupal\materio_migrate\Plugin\migrate\source;
use Drupal\migrate\Row;
use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
/**
* Taxonomy term source from database.
*
* @MigrateSource(
* id = "d7_taxonomy_term_showroom",
* source_module = "taxonomy"
* )
*/
class D7TaxonomyTermShowroom extends FieldableEntity {
/**
* {@inheritdoc}
*/
public function query() {
$query = $this->select('taxonomy_term_data', 'td')
->fields('td')
->distinct()
->orderBy('tid');
$query->leftJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid');
$query->addField('tv', 'machine_name');
if (isset($this->configuration['bundle'])) {
$query->condition('tv.machine_name', (array) $this->configuration['bundle'], 'IN');
}
return $query;
}
/**
* {@inheritdoc}
*/
public function fields() {
$fields = [
'tid' => $this->t('The term ID.'),
'vid' => $this->t('Existing term VID'),
'machine_name' => $this->t('Vocabulary machine name'),
'name' => $this->t('The name of the term.'),
'description' => $this->t('The term description.'),
'weight' => $this->t('Weight'),
'parent' => $this->t("The Drupal term IDs of the term's parents."),
'format' => $this->t("Format of the term description."),
];
return $fields;
}
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row) {
print("\n".'-- prepareRow -- '.$row->getSourceProperty('tid')." -- ".$row->getSourceProperty('name')."\n");
// Get Field API field values.
foreach (array_keys($this->getFields('taxonomy_term', $row->getSourceProperty('machine_name'))) as $field) {
$tid = $row->getSourceProperty('tid');
$row->setSourceProperty($field, $this->getFieldValues('taxonomy_term', $field, $tid));
}
// Find parents for this row.
$parents = $this->select('taxonomy_term_hierarchy', 'th')
->fields('th', ['parent', 'tid'])
->condition('tid', $row->getSourceProperty('tid'))
->execute()
->fetchCol();
$row->setSourceProperty('parent', $parents);
// print_r($parents);
// If the term name or term description were replaced by real fields using
// the Drupal 7 Title module, use the fields value instead of the term name
// or term description.
// TODO: translations
if ($this->moduleExists('title')) {
$name_field = $row->getSourceProperty('name_field');
// print_r($name_field);
if (isset($name_field[0]['value'])) {
$row->setSourceProperty('name', $name_field[0]['value']);
}
$description_field = $row->getSourceProperty('description_field');
if (isset($description_field[0]['value'])) {
$row->setSourceProperty('description', $description_field[0]['value']);
}
}
return parent::prepareRow($row);
}
/**
* {@inheritdoc}
*/
public function getIds() {
$ids['tid']['type'] = 'integer';
return $ids;
}
}

View File

@ -0,0 +1,112 @@
<?php
namespace Drupal\materio_migrate\Plugin\migrate\source;
use Drupal\migrate\Row;
use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
/**
* Taxonomy term source from database.
*
* @MigrateSource(
* id = "d7_taxonomy_term_tags",
* source_module = "taxonomy"
* )
*/
class D7TaxonomyTermTags extends FieldableEntity {
/**
* {@inheritdoc}
*/
public function query() {
$query = $this->select('taxonomy_term_data', 'td')
->fields('td')
->distinct()
->orderBy('tid');
$query->leftJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid');
$query->addField('tv', 'machine_name');
if (isset($this->configuration['bundle'])) {
$query->condition('tv.machine_name', (array) $this->configuration['bundle'], 'IN');
}
return $query;
}
/**
* {@inheritdoc}
*/
public function fields() {
$fields = [
'tid' => $this->t('The term ID.'),
'vid' => $this->t('Existing term VID'),
'machine_name' => $this->t('Vocabulary machine name'),
'name' => $this->t('The name of the term.'),
'description' => $this->t('The term description.'),
'weight' => $this->t('Weight'),
'parent' => $this->t("The Drupal term IDs of the term's parents."),
'format' => $this->t("Format of the term description."),
'synonyms' => $this->t("Term's Synonyms (field : synonyms_synonym)"),
];
return $fields;
}
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row) {
print("\n\n".'-- prepareRow -- '.$row->getSourceProperty('tid')." -- ".$row->getSourceProperty('name')."\n");
// Get Field API field values.
foreach (array_keys($this->getFields('taxonomy_term', $row->getSourceProperty('machine_name'))) as $field) {
$tid = $row->getSourceProperty('tid');
$row->setSourceProperty($field, $this->getFieldValues('taxonomy_term', $field, $tid));
}
// Find parents for this row.
$parents = $this->select('taxonomy_term_hierarchy', 'th')
->fields('th', ['parent', 'tid'])
->condition('tid', $row->getSourceProperty('tid'))
->execute()
->fetchCol();
$row->setSourceProperty('parent', $parents);
// print_r($parents);
// If the term name or term description were replaced by real fields using
// the Drupal 7 Title module, use the fields value instead of the term name
// or term description.
// TODO: translations
if ($this->moduleExists('title')) {
$name_field = $row->getSourceProperty('name_field');
// print_r($name_field);
if (isset($name_field[0]['value'])) {
$row->setSourceProperty('name', $name_field[0]['value']);
}
$description_field = $row->getSourceProperty('description_field');
if (isset($description_field[0]['value'])) {
$row->setSourceProperty('description', $description_field[0]['value']);
}
}
// Synonyms
if ($this->moduleExists('title')) {
$synonyms = $row->getSourceProperty('synonyms_synonym');
// print_r($synonyms);
if(!empty($synonyms)){
$row->setSourceProperty('synonyms', $synonyms);
}
}
return parent::prepareRow($row);
}
/**
* {@inheritdoc}
*/
public function getIds() {
$ids['tid']['type'] = 'integer';
return $ids;
}
}

View File

@ -0,0 +1,149 @@
<?php
namespace Drupal\materio_migrate\Plugin\migrate\source;
use Drupal\migrate\Row;
use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
/**
* Taxonomy term source from database.
*
* @MigrateSource(
* id = "d7_taxonomy_term_thesaurus",
* source_module = "taxonomy"
* )
*/
class D7TaxonomyTermThesaurus extends FieldableEntity {
/**
* {@inheritdoc}
*/
public function query() {
$query = $this->select('taxonomy_term_data', 'td')
->fields('td')
->distinct()
->orderBy('tid');
$query->leftJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid');
$query->addField('tv', 'machine_name');
if (isset($this->configuration['bundle'])) {
$query->condition('tv.machine_name', (array) $this->configuration['bundle'], 'IN');
}
return $query;
}
/**
* {@inheritdoc}
*/
public function fields() {
$fields = [
'tid' => $this->t('The term ID.'),
'vid' => $this->t('Existing term VID'),
'machine_name' => $this->t('Vocabulary machine name'),
'name' => $this->t('The name of the term.'),
'description' => $this->t('The term description.'),
'weight' => $this->t('Weight'),
'parent' => $this->t("The Drupal term IDs of the term's parents."),
'format' => $this->t("Format of the term description."),
'synonyms' => $this->t("Term's Synonyms (field : synonyms_synonym)"),
'displayed_on_advanced_search' => $this->t("field_used_on_advanced_search"),
];
return $fields;
}
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row) {
print("\n\n".'-- prepareRow -- '.$row->getSourceProperty('tid')." -- ".$row->getSourceProperty('name')." -- ".$row->getSourceProperty('weight')."\n");
// Get Field API field values.
// foreach (array_keys($this->getFields('taxonomy_term', $row->getSourceProperty('machine_name'))) as $field) {
// $tid = $row->getSourceProperty('tid');
// $row->setSourceProperty($field, $this->getFieldValues('taxonomy_term', $field, $tid));
// print("field: ".$field."\n");
// print_r($this->getFieldValues('taxonomy_term', $field, $tid));
// print("-\n");
// }
// Find parents for this row.
$parents = $this->select('taxonomy_term_hierarchy', 'th')
->fields('th', ['parent', 'tid'])
->condition('tid', $row->getSourceProperty('tid'))
->execute()
->fetchCol();
$row->setSourceProperty('parent', $parents);
// print_r($parents);
// get the english term name as defaut
$query = $this->select('entity_translation', 'et')
// ->fields('et', [
// 'entity_id',
// 'revision_id',
// 'language',
// 'source',
// 'uid',
// 'status',
// 'created',
// 'changed',
// ])
// ->distinct()
->condition('et.entity_type', 'taxonomy_term')
->condition('et.language', 'en')
->condition('rnf.language', 'en')
->condition('et.entity_id', $row->getSourceProperty('tid'));
$query->innerjoin('field_revision_name_field', 'rnf', 'rnf.revision_id = et.revision_id');
$query->fields('rnf', ['name_field_value']);
$name_field_en = $query->execute()->fetchField();
print($name_field_en);
if($name_field_en != NULL && $name_field_en != ""){
$row->setSourceProperty('name', $name_field_en);
}
// If the term name or term description were replaced by real fields using
// the Drupal 7 Title module, use the fields value instead of the term name
// or term description.
// if ($this->moduleExists('title')) {
// $name_field = $row->getSourceProperty('name_field');
// // print_r($name_field);
// if (isset($name_field[0]['value'])) {
// $row->setSourceProperty('name', $name_field[0]['value']);
// }
// $description_field = $row->getSourceProperty('description_field');
// if (isset($description_field[0]['value'])) {
// $row->setSourceProperty('description', $description_field[0]['value']);
// }
// }
// Synonyms
if ($this->moduleExists('title')) {
$synonyms = $row->getSourceProperty('synonyms_synonym');
// print_r($synonyms);
if(!empty($synonyms)){
$row->setSourceProperty('synonyms', $synonyms);
}
}
// displayed_on_advanced_search
$advanced_search = $row->getSourceProperty('field_used_on_advanced_search');
// print_r($advanced_search);
if(!empty($advanced_search)){
$row->setSourceProperty('advanced_search', $advanced_search);
}
return parent::prepareRow($row);
}
/**
* {@inheritdoc}
*/
public function getIds() {
$ids['tid']['type'] = 'integer';
return $ids;
}
}