From a6f2474e2ab9c0e32779e8944438abaf4131ed35 Mon Sep 17 00:00:00 2001
From: HongPong <hongpong@hongpong.com>
Date: Mon, 31 Mar 2025 23:46:36 -0400
Subject: [PATCH 1/6] Body field text_with_summary picker in wizard WIP mostly
 done.

---
 migrations/wordpress_content.yml              |   8 +-
 src/WordPressMigrationGenerator.php           |   6 ++
 .../src/Form/BodyFieldSelectForm.php          | 102 ++++++++++++++++++
 .../src/Wizard/ImportWizard.php               |  10 ++
 4 files changed, 124 insertions(+), 2 deletions(-)
 create mode 100644 wordpress_migrate_ui/src/Form/BodyFieldSelectForm.php

diff --git a/migrations/wordpress_content.yml b/migrations/wordpress_content.yml
index fe0b7e7..e83bd2d 100644
--- a/migrations/wordpress_content.yml
+++ b/migrations/wordpress_content.yml
@@ -72,8 +72,12 @@ process:
     message: 'Cannot import empty titles. This may include trashed posts from the WordPress import file.'
   # @todo: Will need process plugin to rewrite links/img refs.
   # @link https://www.drupal.org/node/2742279
-  'body/value': content
-  'body/summary': excerpt
+  'body/value':
+    - plugin: get
+      source: content
+  'body/summary':
+    - plugin: get
+      source: excerpt
   created:
     plugin: callback
     source: post_date
diff --git a/src/WordPressMigrationGenerator.php b/src/WordPressMigrationGenerator.php
index 5442582..071a359 100644
--- a/src/WordPressMigrationGenerator.php
+++ b/src/WordPressMigrationGenerator.php
@@ -207,6 +207,11 @@ class WordPressMigrationGenerator implements WordPressMigrationGeneratorInterfac
       $process = $this->processUrlPathAliases($process);
     }
     $process['uid']         = $this->uidMapping;
+    $process['body_field']  = $this->configuration[$wordpress_type]['body_field'];
+    // @todo more body field
+    // body/summary = 'excerpt'
+    // body/value = 'content'
+
     $process['body/format'] = [
       'plugin' => 'default_value',
       'default_value' => $this->configuration[$wordpress_type]['text_format'],
@@ -256,6 +261,7 @@ class WordPressMigrationGenerator implements WordPressMigrationGeneratorInterfac
     /** @var \Drupal\Core\Field\FieldDefinitionInterface[] $all_fields */
     $all_fields = $this->entityFieldManager->getFieldDefinitions('node', $this->configuration[$wordpress_type]['type']);
     foreach ($all_fields as $field_name => $field_definition) {
+      //@todo set up body field here probably.
       if ($field_definition->getType() == 'comment') {
         $storage   = $field_definition->getFieldStorageDefinition();
         $id        = $this->configuration['prefix'] . 'wordpress_comment_' . $wordpress_type;
diff --git a/wordpress_migrate_ui/src/Form/BodyFieldSelectForm.php b/wordpress_migrate_ui/src/Form/BodyFieldSelectForm.php
new file mode 100644
index 0000000..3712a8f
--- /dev/null
+++ b/wordpress_migrate_ui/src/Form/BodyFieldSelectForm.php
@@ -0,0 +1,102 @@
+<?php
+
+namespace Drupal\wordpress_migrate_ui\Form;
+
+use Drupal\Core\Entity\EntityFieldManagerInterface;
+use Drupal\Core\Form\FormBase;
+use Drupal\Core\Form\FormStateInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
+/**
+ * Simple wizard step form.
+ *
+ * Designed to run on each content type (posts, pages).
+ */
+class BodyFieldSelectForm extends FormBase {
+
+  /**
+   * Constructs a new BodyFieldSelectForm.
+   *
+   * @param \Drupal\Core\Entity\EntityFieldManagerInterface $entityFieldManager
+   *   The entity field manager.
+   */
+  public function __construct(
+    protected readonly EntityFieldManagerInterface $entityFieldManager,
+  ) {
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function create(ContainerInterface $container): BodyFieldSelectForm|static {
+    return new static(
+      $container->get('entity_field.manager')
+    );
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getFormId(): string {
+    return 'wordpress_migrate_body_field_select_form';
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function buildForm(array $form, FormStateInterface $form_state): array {
+    // Start clean in case we came here via Previous.
+    $cached_values = $form_state->getTemporaryValue('wizard');
+    unset($cached_values['body_field']);
+    $form_state->setTemporaryValue('wizard', $cached_values);
+
+    $form['overview'] = [
+      '#markup' => $this->t('Here you may choose the \'Text (formatted, long, with summary)\' field to import WordPress post body text into. Your content type must have a body field defined, or
+      the node will not have any body text or content. The field
+      can be created within Add Field: \'Formatted Text \'. Currently
+       both the main body and the excerpt (summary) will get imported to this field.'),
+    ];
+
+    $field_map = $this->entityFieldManager->getFieldMap();
+    $options = ['' => $this->t('Do not import')];
+    foreach ($field_map as $entity_type => $fields) {
+      if ($entity_type === 'node') {
+        foreach ($fields as $field_name => $field_settings) {
+          if ($field_settings['type'] === 'text_with_summary') {
+            $options[$field_name] = $field_name;
+          }
+        }
+      }
+    }
+
+    $form['body_field'] = [
+      '#type' => 'select',
+      '#title' => $this->t('Import WordPress body text field into:'),
+      '#options' => $options,
+    ];
+
+    // select body automatically.
+    if (array_key_exists('body', $options)) {
+      $form['body_field']['#default_value'] = $options['body'];
+    }
+
+    return $form;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function validateForm(array &$form, FormStateInterface $form_state): void {
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function submitForm(array &$form, FormStateInterface $form_state): void {
+    $cached_values = $form_state->getTemporaryValue('wizard');
+    $content_type = $cached_values['wordpress_content_type'];
+    $cached_values[$content_type]['body_field'] = $form_state->getValue('body_field');
+    $form_state->setTemporaryValue('wizard', $cached_values);
+  }
+
+}
diff --git a/wordpress_migrate_ui/src/Wizard/ImportWizard.php b/wordpress_migrate_ui/src/Wizard/ImportWizard.php
index be634d2..bb674e5 100644
--- a/wordpress_migrate_ui/src/Wizard/ImportWizard.php
+++ b/wordpress_migrate_ui/src/Wizard/ImportWizard.php
@@ -118,6 +118,11 @@ class ImportWizard extends FormWizardBase {
           'title' => $this->t('Posts'),
           'values' => ['wordpress_content_type' => 'post'],
         ],
+        'body_field_select_post' => [
+          'form' => 'Drupal\wordpress_migrate_ui\Form\BodyFieldSelectForm',
+          'title' => $this->t('Body Field for Posts'),
+          'values' => ['wordpress_content_type' => 'post'],
+        ],
       ];
     }
     if (!empty($cached_values['page']['type'])) {
@@ -127,6 +132,11 @@ class ImportWizard extends FormWizardBase {
           'title' => $this->t('Pages'),
           'values' => ['wordpress_content_type' => 'page'],
         ],
+        'body_field_select_page' => [
+          'form' => 'Drupal\wordpress_migrate_ui\Form\BodyFieldSelectForm',
+          'title' => $this->t('Body Field for Pages'),
+          'values' => ['wordpress_content_type' => 'page'],
+        ],
       ];
     }
     $steps += [
-- 
GitLab


From a2d170da9f1135b0f1bcabeed792406e01204627 Mon Sep 17 00:00:00 2001
From: HongPong <hongpong@hongpong.com>
Date: Wed, 2 Apr 2025 21:23:05 -0400
Subject: [PATCH 2/6] Issue #3516531 by HongPong: body field text picker
 working, UI messages on fields improved, static function
 getBundleFieldnameOptionsFromFieldmap added to form wizard.

---
 migrations/wordpress_content.yml              |  6 ++-
 src/WordPressMigrationGenerator.php           | 27 ++++++-----
 .../src/Form/BodyFieldSelectForm.php          | 46 ++++++++++---------
 .../src/Form/ContentSelectForm.php            |  6 +--
 .../src/Form/ImageSelectForm.php              |  2 +-
 .../src/Wizard/ImportWizard.php               | 30 ++++++++++++
 6 files changed, 78 insertions(+), 39 deletions(-)

diff --git a/migrations/wordpress_content.yml b/migrations/wordpress_content.yml
index e83bd2d..54aec31 100644
--- a/migrations/wordpress_content.yml
+++ b/migrations/wordpress_content.yml
@@ -72,13 +72,15 @@ process:
     message: 'Cannot import empty titles. This may include trashed posts from the WordPress import file.'
   # @todo: Will need process plugin to rewrite links/img refs.
   # @link https://www.drupal.org/node/2742279
-  'body/value':
+  '_content/value':
     - plugin: get
       source: content
-  'body/summary':
+  '_content/summary':
     - plugin: get
       source: excerpt
   created:
+    # @todo This field is not fault tolerant. May be fatal errors.
+    # @link https://www.drupal.org/project/wordpress_migrate/issues/3516516
     plugin: callback
     source: post_date
     callable: strtotime
diff --git a/src/WordPressMigrationGenerator.php b/src/WordPressMigrationGenerator.php
index 68299f1..ed6c415 100644
--- a/src/WordPressMigrationGenerator.php
+++ b/src/WordPressMigrationGenerator.php
@@ -207,19 +207,22 @@ class WordPressMigrationGenerator implements WordPressMigrationGeneratorInterfac
       $process = $this->processUrlPathAliases($process);
     }
     $process['uid']         = $this->uidMapping;
-    $process['body_field']  = $this->configuration[$wordpress_type]['body_field'];
-    // @todo more body field
-    // body/summary = 'excerpt'
-    // body/value = 'content'
+    // Dynamically assign body field content to specified field.
+    if (isset($this->configuration[$wordpress_type]['body_field'])) {
+      $process[$this->configuration[$wordpress_type]['body_field']] = '@_content';
+      // body/summary = 'excerpt'
+      // body/value = 'content'
+
+      $process['_content/format'] = [
+        'plugin' => 'default_value',
+        'default_value' => $this->configuration[$wordpress_type]['text_format'],
+      ];
+      $process['type']        = [
+        'plugin' => 'default_value',
+        'default_value' => $this->configuration[$wordpress_type]['type'],
+      ];
+    }
 
-    $process['body/format'] = [
-      'plugin' => 'default_value',
-      'default_value' => $this->configuration[$wordpress_type]['text_format'],
-    ];
-    $process['type']        = [
-      'plugin' => 'default_value',
-      'default_value' => $this->configuration[$wordpress_type]['type'],
-    ];
     if ($this->configuration['tag_vocabulary']) {
       $term_field = $this->termField($this->configuration[$wordpress_type]['type'], $this->configuration['tag_vocabulary']);
       if ($term_field) {
diff --git a/wordpress_migrate_ui/src/Form/BodyFieldSelectForm.php b/wordpress_migrate_ui/src/Form/BodyFieldSelectForm.php
index 3712a8f..177beeb 100644
--- a/wordpress_migrate_ui/src/Form/BodyFieldSelectForm.php
+++ b/wordpress_migrate_ui/src/Form/BodyFieldSelectForm.php
@@ -6,11 +6,13 @@ use Drupal\Core\Entity\EntityFieldManagerInterface;
 use Drupal\Core\Form\FormBase;
 use Drupal\Core\Form\FormStateInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
-
+use Drupal\wordpress_migrate_ui\Wizard\ImportWizard;
 /**
  * Simple wizard step form.
  *
+ *
  * Designed to run on each content type (posts, pages).
+ * $form_state->getTemporaryValue('wizard'); Use CachedValues for state.
  */
 class BodyFieldSelectForm extends FormBase {
 
@@ -42,37 +44,39 @@ class BodyFieldSelectForm extends FormBase {
   }
 
   /**
-   * {@inheritdoc}
+   * Via $form_state know which content type is here, pick text_with_summary.
+   *
+   * Use $cached_values for setting this up.
+   *
+   * @param array $form
+   * @param \Drupal\Core\Form\FormStateInterface $form_state
+   *
+   * @return array
    */
   public function buildForm(array $form, FormStateInterface $form_state): array {
-    // Start clean in case we came here via Previous.
+    // Start clean in case we came here via Previous, then set again.
     $cached_values = $form_state->getTemporaryValue('wizard');
     unset($cached_values['body_field']);
     $form_state->setTemporaryValue('wizard', $cached_values);
-
+    $wp_type = (string) $cached_values['wordpress_content_type'];
+    // string post or page. Key off it to set new attribute.
+    $field_map = $this->entityFieldManager->getFieldMap();
+    $needle_form_el_type = 'text_with_summary';
+    $drupal_content_type = (string) $cached_values[$wp_type]['type'];
     $form['overview'] = [
-      '#markup' => $this->t('Here you may choose the \'Text (formatted, long, with summary)\' field to import WordPress post body text into. Your content type must have a body field defined, or
-      the node will not have any body text or content. The field
-      can be created within Add Field: \'Formatted Text \'. Currently
-       both the main body and the excerpt (summary) will get imported to this field.'),
+      '#markup' => $this->t('Here you may choose the \'Text (formatted, long, with summary)\' field to import WordPress @type body text into. Your <strong>:drupaltype</strong> content type must have a body field selected below, or
+      the new node will not have any body text or content. <br /> If missing, the field
+      can be created within <strong>:drupaltype</strong> fields via: Add Field: \'Formatted Text \'. Currently,
+       both the main body and the excerpt (summary) will get imported to the  field selected below.', ['@type' => $wp_type, ':drupaltype' => $drupal_content_type ]),
     ];
-
-    $field_map = $this->entityFieldManager->getFieldMap();
     $options = ['' => $this->t('Do not import')];
-    foreach ($field_map as $entity_type => $fields) {
-      if ($entity_type === 'node') {
-        foreach ($fields as $field_name => $field_settings) {
-          if ($field_settings['type'] === 'text_with_summary') {
-            $options[$field_name] = $field_name;
-          }
-        }
-      }
-    }
+    $options = ImportWizard::getBundleFieldnameOptionsFromFieldmap($field_map, $cached_values, $options, $wp_type, $needle_form_el_type);
 
     $form['body_field'] = [
       '#type' => 'select',
-      '#title' => $this->t('Import WordPress body text field into:'),
+      '#title' => $this->t('Import WordPress @type body text field into:', ['@type' => $wp_type]),
       '#options' => $options,
+      '#description' => $this->t('The @type body text will be imported to this field (within the field: full body, and excerpt/summary).', ['@type' => $wp_type]),
     ];
 
     // select body automatically.
@@ -90,7 +94,7 @@ class BodyFieldSelectForm extends FormBase {
   }
 
   /**
-   * {@inheritdoc}
+   * uses $cached_values wizard $form_state to set results per content type.
    */
   public function submitForm(array &$form, FormStateInterface $form_state): void {
     $cached_values = $form_state->getTemporaryValue('wizard');
diff --git a/wordpress_migrate_ui/src/Form/ContentSelectForm.php b/wordpress_migrate_ui/src/Form/ContentSelectForm.php
index 558c4fe..dd3634b 100644
--- a/wordpress_migrate_ui/src/Form/ContentSelectForm.php
+++ b/wordpress_migrate_ui/src/Form/ContentSelectForm.php
@@ -56,7 +56,7 @@ class ContentSelectForm extends FormBase {
     $form_state->setTemporaryValue('wizard', $cached_values);
 
     $form['overview'] = [
-      '#markup' => $this->t('WordPress blogs contain two primary kinds of content, blog posts and pages. Here you may choose what types of Drupal nodes to create from each of those content types, or omit one or both from the import entirely.'),
+      '#markup' => $this->t('WordPress blogs contain two primary kinds of content, blog posts and pages. Here you may choose what types of Drupal nodes (content types) to create from posts and pages. Or you can omit one or both from the migration group entirely.<br />Note: In Drupal fields are separate from content types. You may need to add fields to these content types in order for the imports to work correctly (For example, tags, categories, and featured image fields). In the next steps of the wizard, field options may be shown which are <em>not</em> associated to the selected content types below.'),
     ];
 
     // Get destination node type(s)
@@ -68,13 +68,13 @@ class ContentSelectForm extends FormBase {
 
     $form['blog_post_type'] = [
       '#type' => 'select',
-      '#title' => $this->t('Import WordPress blog posts as'),
+      '#title' => $this->t('Import WordPress blog posts as Drupal content type nodes:'),
       '#options' => $options,
     ];
 
     $form['page_type'] = [
       '#type' => 'select',
-      '#title' => $this->t('Import WordPress pages as'),
+      '#title' => $this->t('Import WordPress pages as Drupal content type nodes:'),
       '#options' => $options,
     ];
 
diff --git a/wordpress_migrate_ui/src/Form/ImageSelectForm.php b/wordpress_migrate_ui/src/Form/ImageSelectForm.php
index 2505375..0935026 100644
--- a/wordpress_migrate_ui/src/Form/ImageSelectForm.php
+++ b/wordpress_migrate_ui/src/Form/ImageSelectForm.php
@@ -49,7 +49,7 @@ class ImageSelectForm extends FormBase {
     $form_state->setTemporaryValue('wizard', $cached_values);
 
     $form['overview'] = [
-      '#markup' => $this->t('Here you may choose the Drupal image field to import Wordpress featured images into.'),
+      '#markup' => $this->t('Here you may choose the Drupal image field to import WordPress featured images into. <br /><strong>Note</strong>: Make sure this field is connected to your Drupal import content type. It may not be associated.'),
     ];
 
     $field_map = $this->entityFieldManager->getFieldMap();
diff --git a/wordpress_migrate_ui/src/Wizard/ImportWizard.php b/wordpress_migrate_ui/src/Wizard/ImportWizard.php
index fb6ad52..ebe0ef8 100644
--- a/wordpress_migrate_ui/src/Wizard/ImportWizard.php
+++ b/wordpress_migrate_ui/src/Wizard/ImportWizard.php
@@ -15,6 +15,9 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 /**
  * Imports the wizard.
  *
+ * Inside the form wizard steps:
+ * $form_state->getTemporaryValue('wizard'); Use CachedValues for state.
+ *
  * @package Drupal\wordpress_migrate_ui\Wizard
  */
 class ImportWizard extends FormWizardBase {
@@ -168,4 +171,31 @@ class ImportWizard extends FormWizardBase {
     parent::finish($form, $form_state);
   }
 
+  /**
+   * For inside steps, select correct choice options for body text field.
+   *
+   * Keyed form select elements for the dropdown fields to pick from. Per
+   * whichever 'post' or 'page' + target content type picked earlier.
+   *
+   * @param $field_map array
+   * @param $cached_vals array
+   * @param $options array Select menu element.
+   * @param $wp_type string 'post' or 'page'.
+   *
+   */
+  public static function getBundleFieldnameOptionsFromFieldmap(array $field_map, array $cached_vals, array $options, string $wp_type, string $needle_form_el_type): array {
+    $drupal_content_type = $cached_vals[$wp_type]['type'];
+    foreach ($field_map as $entity_type => $fields) {
+      if ($entity_type === 'node') {
+        foreach ($fields as $field_name => $field_settings) {
+          // the magic.
+          if (($field_settings['type'] === $needle_form_el_type) && array_intersect($field_settings['bundles'], [$drupal_content_type])) {
+            $options[$field_name] = $field_name;
+          }
+        }
+      }
+    }
+    return $options;
+  }
+
 }
-- 
GitLab


From b5e396c0d7c1a92bf138e0bcc8f936ed4b0a3b9b Mon Sep 17 00:00:00 2001
From: HongPong <hongpong@hongpong.com>
Date: Wed, 2 Apr 2025 21:28:50 -0400
Subject: [PATCH 3/6] removed comment

---
 src/WordPressMigrationGenerator.php | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/WordPressMigrationGenerator.php b/src/WordPressMigrationGenerator.php
index ed6c415..344d892 100644
--- a/src/WordPressMigrationGenerator.php
+++ b/src/WordPressMigrationGenerator.php
@@ -264,7 +264,6 @@ class WordPressMigrationGenerator implements WordPressMigrationGeneratorInterfac
     /** @var \Drupal\Core\Field\FieldDefinitionInterface[] $all_fields */
     $all_fields = $this->entityFieldManager->getFieldDefinitions('node', $this->configuration[$wordpress_type]['type']);
     foreach ($all_fields as $field_name => $field_definition) {
-      //@todo set up body field here probably.
       if ($field_definition->getType() == 'comment') {
         $storage   = $field_definition->getFieldStorageDefinition();
         $id        = $this->configuration['prefix'] . 'wordpress_comment_' . $wordpress_type;
-- 
GitLab


From 60c509b38c06f0083904f091d929cbf09ea800b9 Mon Sep 17 00:00:00 2001
From: HongPong <hongpong@hongpong.com>
Date: Wed, 2 Apr 2025 21:31:25 -0400
Subject: [PATCH 4/6] cspell linter

---
 .cspell-project-words.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.cspell-project-words.txt b/.cspell-project-words.txt
index f79ef95..42a0188 100644
--- a/.cspell-project-words.txt
+++ b/.cspell-project-words.txt
@@ -57,3 +57,5 @@ lobodakyrylo
 uridrupal
 vaidas_a
 tempstore
+drupaltype
+fieldmap
-- 
GitLab


From 2de292b18b436065b2b458e5a9516dc5203b919c Mon Sep 17 00:00:00 2001
From: HongPong <hongpong@hongpong.com>
Date: Wed, 2 Apr 2025 21:35:46 -0400
Subject: [PATCH 5/6] correct the UI message: one of the content types (pages
 or posts) must be picked

---
 wordpress_migrate_ui/src/Form/ContentSelectForm.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/wordpress_migrate_ui/src/Form/ContentSelectForm.php b/wordpress_migrate_ui/src/Form/ContentSelectForm.php
index dd3634b..9f444aa 100644
--- a/wordpress_migrate_ui/src/Form/ContentSelectForm.php
+++ b/wordpress_migrate_ui/src/Form/ContentSelectForm.php
@@ -56,7 +56,7 @@ class ContentSelectForm extends FormBase {
     $form_state->setTemporaryValue('wizard', $cached_values);
 
     $form['overview'] = [
-      '#markup' => $this->t('WordPress blogs contain two primary kinds of content, blog posts and pages. Here you may choose what types of Drupal nodes (content types) to create from posts and pages. Or you can omit one or both from the migration group entirely.<br />Note: In Drupal fields are separate from content types. You may need to add fields to these content types in order for the imports to work correctly (For example, tags, categories, and featured image fields). In the next steps of the wizard, field options may be shown which are <em>not</em> associated to the selected content types below.'),
+      '#markup' => $this->t('WordPress blogs contain two primary kinds of content, blog posts and pages. Here you may choose what types of Drupal nodes (content types) to create from posts and pages. Or you can omit one (but not both) from the migration group entirely.<br />Note: In Drupal fields are separate from content types. You may need to add fields to these content types in order for the imports to work correctly (For example, tags, categories, and featured image fields). In the next steps of the wizard, field options may be shown which are <em>not</em> associated to the selected content types below.'),
     ];
 
     // Get destination node type(s)
-- 
GitLab


From c7210b3b3826c1fed125d7a2424783378e5a52d5 Mon Sep 17 00:00:00 2001
From: HongPong <hongpong@hongpong.com>
Date: Thu, 3 Apr 2025 02:14:36 -0400
Subject: [PATCH 6/6] Issue #3516531 by HongPong: code linting

---
 src/WordPressMigrationGenerator.php                 |  7 +++----
 .../src/Form/BodyFieldSelectForm.php                | 10 +++++-----
 wordpress_migrate_ui/src/Wizard/ImportWizard.php    | 13 +++++++------
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/WordPressMigrationGenerator.php b/src/WordPressMigrationGenerator.php
index 344d892..0a2ef65 100644
--- a/src/WordPressMigrationGenerator.php
+++ b/src/WordPressMigrationGenerator.php
@@ -206,18 +206,17 @@ class WordPressMigrationGenerator implements WordPressMigrationGeneratorInterfac
     if ($this->configuration['base_url'] !== '') {
       $process = $this->processUrlPathAliases($process);
     }
-    $process['uid']         = $this->uidMapping;
+    $process['uid'] = $this->uidMapping;
     // Dynamically assign body field content to specified field.
     if (isset($this->configuration[$wordpress_type]['body_field'])) {
       $process[$this->configuration[$wordpress_type]['body_field']] = '@_content';
       // body/summary = 'excerpt'
-      // body/value = 'content'
-
+      // body/value = 'content'.
       $process['_content/format'] = [
         'plugin' => 'default_value',
         'default_value' => $this->configuration[$wordpress_type]['text_format'],
       ];
-      $process['type']        = [
+      $process['type']            = [
         'plugin' => 'default_value',
         'default_value' => $this->configuration[$wordpress_type]['type'],
       ];
diff --git a/wordpress_migrate_ui/src/Form/BodyFieldSelectForm.php b/wordpress_migrate_ui/src/Form/BodyFieldSelectForm.php
index 177beeb..e753ee5 100644
--- a/wordpress_migrate_ui/src/Form/BodyFieldSelectForm.php
+++ b/wordpress_migrate_ui/src/Form/BodyFieldSelectForm.php
@@ -7,10 +7,10 @@ use Drupal\Core\Form\FormBase;
 use Drupal\Core\Form\FormStateInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Drupal\wordpress_migrate_ui\Wizard\ImportWizard;
+
 /**
  * Simple wizard step form.
  *
- *
  * Designed to run on each content type (posts, pages).
  * $form_state->getTemporaryValue('wizard'); Use CachedValues for state.
  */
@@ -59,7 +59,7 @@ class BodyFieldSelectForm extends FormBase {
     unset($cached_values['body_field']);
     $form_state->setTemporaryValue('wizard', $cached_values);
     $wp_type = (string) $cached_values['wordpress_content_type'];
-    // string post or page. Key off it to set new attribute.
+    // String post or page. Key off it to set new attribute.
     $field_map = $this->entityFieldManager->getFieldMap();
     $needle_form_el_type = 'text_with_summary';
     $drupal_content_type = (string) $cached_values[$wp_type]['type'];
@@ -67,7 +67,7 @@ class BodyFieldSelectForm extends FormBase {
       '#markup' => $this->t('Here you may choose the \'Text (formatted, long, with summary)\' field to import WordPress @type body text into. Your <strong>:drupaltype</strong> content type must have a body field selected below, or
       the new node will not have any body text or content. <br /> If missing, the field
       can be created within <strong>:drupaltype</strong> fields via: Add Field: \'Formatted Text \'. Currently,
-       both the main body and the excerpt (summary) will get imported to the  field selected below.', ['@type' => $wp_type, ':drupaltype' => $drupal_content_type ]),
+       both the main body and the excerpt (summary) will get imported to the  field selected below.', ['@type' => $wp_type, ':drupaltype' => $drupal_content_type]),
     ];
     $options = ['' => $this->t('Do not import')];
     $options = ImportWizard::getBundleFieldnameOptionsFromFieldmap($field_map, $cached_values, $options, $wp_type, $needle_form_el_type);
@@ -79,7 +79,7 @@ class BodyFieldSelectForm extends FormBase {
       '#description' => $this->t('The @type body text will be imported to this field (within the field: full body, and excerpt/summary).', ['@type' => $wp_type]),
     ];
 
-    // select body automatically.
+    // Select body automatically.
     if (array_key_exists('body', $options)) {
       $form['body_field']['#default_value'] = $options['body'];
     }
@@ -94,7 +94,7 @@ class BodyFieldSelectForm extends FormBase {
   }
 
   /**
-   * uses $cached_values wizard $form_state to set results per content type.
+   * Uses $cached_values wizard $form_state to set results per content type.
    */
   public function submitForm(array &$form, FormStateInterface $form_state): void {
     $cached_values = $form_state->getTemporaryValue('wizard');
diff --git a/wordpress_migrate_ui/src/Wizard/ImportWizard.php b/wordpress_migrate_ui/src/Wizard/ImportWizard.php
index ebe0ef8..33e1197 100644
--- a/wordpress_migrate_ui/src/Wizard/ImportWizard.php
+++ b/wordpress_migrate_ui/src/Wizard/ImportWizard.php
@@ -177,18 +177,19 @@ class ImportWizard extends FormWizardBase {
    * Keyed form select elements for the dropdown fields to pick from. Per
    * whichever 'post' or 'page' + target content type picked earlier.
    *
-   * @param $field_map array
-   * @param $cached_vals array
-   * @param $options array Select menu element.
-   * @param $wp_type string 'post' or 'page'.
-   *
+   * @param array $field_map
+   * @param array $cached_vals
+   * @param $options
+   *   array Select menu element.
+   * @param $wp_type
+   *   string 'post' or 'page'.
    */
   public static function getBundleFieldnameOptionsFromFieldmap(array $field_map, array $cached_vals, array $options, string $wp_type, string $needle_form_el_type): array {
     $drupal_content_type = $cached_vals[$wp_type]['type'];
     foreach ($field_map as $entity_type => $fields) {
       if ($entity_type === 'node') {
         foreach ($fields as $field_name => $field_settings) {
-          // the magic.
+          // The magic.
           if (($field_settings['type'] === $needle_form_el_type) && array_intersect($field_settings['bundles'], [$drupal_content_type])) {
             $options[$field_name] = $field_name;
           }
-- 
GitLab