Last active
          March 29, 2019 01:41 
        
      - 
      
- 
        Save labboy0276/69dca7682cefe8c816ed86b6fd466520 to your computer and use it in GitHub Desktop. 
    Various Drupal 8 Body Migration Techniques Ways
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | use Drupal\migrate\Plugin\MigrationInterface; | |
| use Drupal\migrate\Plugin\MigrateSourceInterface; | |
| use Drupal\migrate\Row; | |
| /** | |
| * Implements hook_migrate_prepare_row(). | |
| */ | |
| function YOUR_MODULE_migrate_prepare_row(Row $row, MigrateSourceInterface $source, MigrationInterface $migration) { | |
| switch ($migration->id()) { | |
| case 'config_name': | |
| $body = $row->getSourceProperty('body'); | |
| $row->setSourceProperty('body_value', $body[0]['value']); | |
| $row->setSourceProperty('body_summary', $body[0]['summary']); | |
| $row->setSourceProperty('body_format', $body[0]['format']); | |
| break; | |
| } | |
| } | 
  
    
      This file contains hidden or 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
    
  
  
    
  | process: | |
| 'body/value': body_value | |
| 'body/summary': body_summary | |
| 'body/format': | |
| plugin: static_map | |
| source: body_format | |
| map: | |
| full_html: full_html | |
| filtered_html: basic_html | |
| pure_html: full_html | |
| plain_text: plain_text | |
| php_code: full_html | 
  
    
      This file contains hidden or 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
    
  
  
    
  | process: | |
| body: | |
| plugin: sub_process | |
| source: body | |
| process: | |
| value: value | |
| summary: summary | |
| format: | |
| plugin: static_map | |
| source: format | |
| map: | |
| full_html: full_html | |
| filtered_html: basic_html | |
| pure_html: full_html | |
| plain_text: plain_text | |
| php_code: full_html | 
  
    
      This file contains hidden or 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
    
  
  
    
  | source: | |
| constants: | |
| format: basic_html | |
| process: | |
| body/value: | |
| plugin: extract | |
| source: body | |
| index: | |
| - 0 | |
| - value | |
| body/format: constants/format | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment