Commit 18ded023 authored by quietone's avatar quietone Committed by hass

Issue #2977567 by quietone: Migrate D7 user data to D8

parent c6df8324
......@@ -12,11 +12,9 @@ process:
key: 'constants/key'
module: 'constants/module'
settings:
# Based on skip_row_if_not_set
plugin: google_analytics_skip_row_if_not_set
key: custom
module: googleanalytics
source: data
plugin: skip_row_if_not_set
index: 'custom'
source: data/google_analytics
destination:
plugin: user_data
migration_dependencies:
......
......@@ -12,11 +12,9 @@ process:
key: 'constants/key'
module: 'constants/module'
settings:
# Based on skip_row_if_not_set
plugin: google_analytics_skip_row_if_not_set
key: custom
module: googleanalytics
source: data
plugin: skip_row_if_not_set
index: 'custom'
source: data/google_analytics
destination:
plugin: user_data
migration_dependencies:
......
<?php
namespace Drupal\google_analytics\Plugin\migrate\process;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Row;
use Drupal\migrate\MigrateSkipRowException;
/**
* If the source evaluates to empty, we skip the current row.
*
* @MigrateProcessPlugin(
* id = "google_analytics_skip_row_if_not_set",
* handle_multiples = TRUE
* )
*/
class GoogleAnalyticsSkipRowIfNotSet extends ProcessPluginBase {
/**
* {@inheritdoc}
*/
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
if (!isset($value[$this->configuration['module']][$this->configuration['key']])) {
throw new MigrateSkipRowException();
}
return $value[$this->configuration['module']][$this->configuration['key']];
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment