diff --git a/web/modules/custom/geo_upgrade/migrations/upgrade_d7_node_story_author.yml b/web/modules/custom/geo_upgrade/migrations/upgrade_d7_node_story_author.yml new file mode 100644 index 0000000..4a0aad5 --- /dev/null +++ b/web/modules/custom/geo_upgrade/migrations/upgrade_d7_node_story_author.yml @@ -0,0 +1,27 @@ +langcode: en +status: true +dependencies: { } +id: upgrade_d7_node_story_author +class: Drupal\migrate\Plugin\Migration +field_plugin_method: alterFieldInstanceMigration +cck_plugin_method: null +migration_tags: + - 'Drupal 7' + - Content +migration_group: migrate_drupal_7_geo +label: 'Authors (Story authors)' +source: + constants: + user_id: 1 + author_status: 1 + plugin: geod7_author +process: + title: field_author_value + uid: constants/user_id + status: constants/author_status +destination: + plugin: 'entity:node' + default_bundle: people +migration_dependencies: + required: { } + optional: { } diff --git a/web/modules/custom/geo_upgrade/src/Plugin/migrate/source/Author.php b/web/modules/custom/geo_upgrade/src/Plugin/migrate/source/Author.php new file mode 100644 index 0000000..215d5b6 --- /dev/null +++ b/web/modules/custom/geo_upgrade/src/Plugin/migrate/source/Author.php @@ -0,0 +1,63 @@ +getSourceProperty('field_author_value'); + // Make sure to all the author names are trimmed. + $row->setSourceProperty('field_author_value', trim($field_author)); + + return parent::prepareRow($row); + } + + /** + * {@inheritdoc} + */ + public function fields() { + $fields = [ + 'field_author_value' => $this->t('Author Name'), + ]; + return $fields; + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['field_author_value']['type'] = 'string'; + $ids['field_author_value']['alias'] = 'fdfa'; + + return $ids; + } + + /** + * {@inheritdoc} + */ + public function query() { + $select = $this->select('field_data_field_author', 'fdfa') + ->fields('fdfa', [ + 'field_author_value', + ]) + ->groupBy('field_author_value'); + + return $select; + } + +}