You are here

protected function Paragraphs::paragraphAlterFieldWidgetMigration in Paragraphs 8

Adds processes for paragraphs field widgets.

Parameters

\Drupal\migrate\Plugin\MigrationInterface $migration: The migration.

1 call to Paragraphs::paragraphAlterFieldWidgetMigration()
Paragraphs::alterFieldWidgetMigration in src/Plugin/migrate/field/Paragraphs.php
Apply any custom processing to the field widget migration.

File

src/Plugin/migrate/field/Paragraphs.php, line 170

Class

Paragraphs
Field Plugin for paragraphs migrations.

Namespace

Drupal\paragraphs\Plugin\migrate\field

Code

protected function paragraphAlterFieldWidgetMigration(MigrationInterface $migration) {
  $title = [
    'paragraphs' => [
      'plugin' => 'paragraphs_process_on_value',
      'source_value' => 'type',
      'expected_value' => 'paragraphs',
      'process' => [
        'plugin' => 'get',
        'source' => 'settings/title',
      ],
    ],
  ];
  $title_plural = [
    'paragraphs' => [
      'plugin' => 'paragraphs_process_on_value',
      'source_value' => 'type',
      'expected_value' => 'paragraphs',
      'process' => [
        'plugin' => 'get',
        'source' => 'settings/title_multiple',
      ],
    ],
  ];
  $edit_mode = [
    'paragraphs' => [
      'plugin' => 'paragraphs_process_on_value',
      'source_value' => 'type',
      'expected_value' => 'paragraphs',
      'process' => [
        'plugin' => 'get',
        'source' => 'settings/default_edit_mode',
      ],
    ],
  ];
  $add_mode = [
    'paragraphs' => [
      'plugin' => 'paragraphs_process_on_value',
      'source_value' => 'type',
      'expected_value' => 'paragraphs',
      'process' => [
        'plugin' => 'get',
        'source' => 'settings/add_mode',
      ],
    ],
  ];
  $migration
    ->mergeProcessOfProperty('options/settings/title', $title);
  $migration
    ->mergeProcessOfProperty('options/settings/title_plural', $title_plural);
  $migration
    ->mergeProcessOfProperty('options/settings/edit_mode', $edit_mode);
  $migration
    ->mergeProcessOfProperty('options/settings/add_mode', $add_mode);
}