function forum_migrate_prepare_row
Same name in other branches
- 11.x core/modules/forum/forum.module \forum_migrate_prepare_row()
Implements hook_migrate_prepare_row().
File
-
core/
modules/ forum/ forum.module, line 666
Code
function forum_migrate_prepare_row(Row $row, MigrateSourceInterface $source, MigrationInterface $migration) {
$source_plugin = $migration->getSourcePlugin();
if (is_a($source_plugin, D6Term::class) || is_a($source_plugin, D7Term::class) || is_a($source_plugin, TermEntityTranslation::class)) {
$connection = $source_plugin->getDatabase();
if ($connection) {
if ($connection->schema()
->tableExists('variable')) {
$query = $connection->select('variable', 'v')
->fields('v', [
'value',
])
->condition('name', 'forum_containers');
$result = $query->execute()
->fetchCol();
if ($result) {
$forum_container_tids = unserialize($result[0], [
'allowed_classes' => FALSE,
]);
$current_tid = $row->getSourceProperty('tid');
$row->setSourceProperty('is_container', in_array($current_tid, $forum_container_tids));
}
}
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.