Created
August 12, 2016 17:48
-
-
Save haringsrob/d38e7a8d17ea47d4eaf7068c487d3074 to your computer and use it in GitHub Desktop.
Convert Drupal 7 Email field to drupal 8 Processor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\base\Plugin\migrate\process; | |
use Drupal\migrate\ProcessPluginBase; | |
use Drupal\migrate\MigrateExecutableInterface; | |
use Drupal\migrate\Row; | |
/** | |
* This plugin converts Drupal 7 email field to drupal 8 | |
* | |
* field_mail: | |
* plugin: email_convert | |
* source: field_e_mail | |
* | |
* @MigrateProcessPlugin( | |
* id = "email_convert" | |
* ) | |
*/ | |
class EmailConvert extends ProcessPluginBase { | |
/** | |
* {@inheritdoc} | |
*/ | |
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { | |
if (is_array($value) && isset($value['email'])) { | |
return $value['email']; | |
} | |
return $value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Alternatively you can just add..