You are here

public function AuthorForm::buildForm in WordPress Migrate 8.3

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides FormInterface::buildForm

File

wordpress_migrate_ui/src/Form/AuthorForm.php, line 26

Class

AuthorForm
Simple wizard step form.

Namespace

Drupal\wordpress_migrate_ui\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['overview'] = [
    '#markup' => $this
      ->t('User accounts for authors in the WordPress blog may be imported to Drupal. If you select <strong>Yes</strong>, any authors in the WordPress file who do not match existing Drupal accounts (based on email address) will have new Drupal accounts automatically created. Note that their passwords are not imported - they must be reset after import.<br/>If you select <strong>No</strong>, you must choose an existing Drupal account which will be the author of any WordPress content whose author is not imported.'),
  ];
  $form['perform_user_migration'] = [
    '#type' => 'radios',
    '#title' => $this
      ->t('Create new users for existing WordPress content authors?'),
    '#options' => [
      1 => $this
        ->t('Yes'),
      0 => $this
        ->t('No'),
    ],
    '#default_value' => 1,
  ];
  $form['default_author'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Username of default content author:'),
    '#default_value' => $this
      ->currentUser()
      ->getAccountName(),
    '#autocomplete_path' => 'user/autocomplete',
    '#states' => [
      'invisible' => [
        'input[name="perform_user_migration"]' => [
          'value' => 1,
        ],
      ],
    ],
  ];
  return $form;
}