Guest User

Untitled

a guest
Mar 21st, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Drupalcustom_url_migratepluginmigratefield;
  4.  
  5. use DrupalmigratePluginMigrationInterface;
  6. use Drupalmigrate_drupalPluginmigratefieldFieldPluginBase;
  7.  
  8. /**
  9. * @MigrateField(
  10. * id = "url",
  11. * core = {7},
  12. * type_map = {
  13. * "url" = "link"
  14. * },
  15. * source_module = "url",
  16. * destination_module = "link"
  17. * )
  18. */
  19. class url extends FieldPluginBase {
  20.  
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public function getFieldWidgetMap() {
  25. return [
  26. 'url' => 'link',
  27. ];
  28. }
  29.  
  30. /**
  31. * {@inheritdoc}
  32. */
  33. public function getFieldFormatterMap() {
  34. return [
  35. //'default' => 'link',
  36. //'url' => 'link',
  37. 'url_external' => 'link',
  38. ];
  39. }
  40.  
  41. /**
  42. * {@inheritdoc}
  43. */
  44. public function processFieldValues(MigrationInterface $migration, $field_name, $data) {
  45. $process = [
  46. 'plugin' => 'sub_process',
  47. 'source' => $field_name,
  48. 'process' => [
  49. 'uri' => 'value',
  50. ],
  51. ];
  52. $migration->setProcessOfProperty($field_name, $process);
  53. }
  54.  
  55. }
Add Comment
Please, Sign In to add comment