From e004900b933aba22cb34a75b066513658c9745dc Mon Sep 17 00:00:00 2001 From: Jo Fitzgerald Date: Thu, 24 Mar 2016 16:50:14 +0000 Subject: [PATCH] D7 migration template and plugins. --- migration_templates/d7_path_redirect.yml | 25 ++++++++ .../migrate/process/d7/PathRedirect.php | 51 ++++++++++++++++ .../process/d7/RedirectSourceQuery.php | 41 +++++++++++++ src/Plugin/migrate/source/d7/PathRedirect.php | 58 +++++++++++++++++++ 4 files changed, 175 insertions(+) create mode 100755 migration_templates/d7_path_redirect.yml create mode 100755 src/Plugin/migrate/process/d7/PathRedirect.php create mode 100755 src/Plugin/migrate/process/d7/RedirectSourceQuery.php create mode 100755 src/Plugin/migrate/source/d7/PathRedirect.php diff --git a/migration_templates/d7_path_redirect.yml b/migration_templates/d7_path_redirect.yml new file mode 100755 index 0000000..87e5514 --- /dev/null +++ b/migration_templates/d7_path_redirect.yml @@ -0,0 +1,25 @@ +id: d7_path_redirect +label: Path Redirect +migration_tags: + - Drupal 7 +source: + plugin: d7_path_redirect +process: + rid: rid + uid: uid + redirect_source/path: source + redirect_source/query: + plugin: d7_redirect_source_query + source: source_options + redirect_redirect/uri: + plugin: d7_path_redirect + source: + - redirect + - redirect_options + language: + plugin: default_value + source: language + default_value: und + status_code: status_code +destination: + plugin: entity:redirect \ No newline at end of file diff --git a/src/Plugin/migrate/process/d7/PathRedirect.php b/src/Plugin/migrate/process/d7/PathRedirect.php new file mode 100755 index 0000000..44659a3 --- /dev/null +++ b/src/Plugin/migrate/process/d7/PathRedirect.php @@ -0,0 +1,51 @@ +select('redirect', 'p') + ->fields('p'); + + return $query; + } + + /** + * {@inheritdoc} + */ + public function fields() { + // @todo Complete this function for D7. + $fields = array( + 'rid' => $this->t('Redirect ID'), + 'source' => $this->t('Source'), + 'redirect' => $this->t('Redirect'), + 'query' => $this->t('Query'), + 'fragment' => $this->t('Fragment'), + 'language' => $this->t('Language'), + 'type' => $this->t('Type'), + 'last_used' => $this->t('Last Used'), + ); + return $fields; + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['rid']['type'] = 'integer'; + return $ids; + } + +}